Discussions

Expand all | Collapse all

Creating a button that creates and populates a new record without opening the record

  • 1.  Creating a button that creates and populates a new record without opening the record

    Bronze
    Contributor
    Posted 09-04-2017 18:44
    Here is the code - with the help of Matthew Neil! However, the date is not populating into the record, and I would also like it to pull the name of the person identified in the parent record.


    var text URL= URLRoot() & "db/" & [_DBID_CHILD_TABLE_ID] & "?a=API_AddRecord&_fid_yy="&URLEncode ([Record ID#])&"&apptoken=zzzzzzzzzzzz&_fid_xx="&URLEncode(Today());

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);


  • 2.  RE: Creating a button that creates and populates a new record without opening the record

    Top
    Contributor
    Posted 09-04-2017 18:49
    Can you post "your" formula?  You can change the app token to zzzzzz, but please leave the rest of it as is.  Then I should be able to spot the error.


  • 3.  RE: Creating a button that creates and populates a new record without opening the record

    Bronze
    Contributor
    Posted 09-04-2017 18:51
    Here you go... Also started a new thread.

    var text URL= URLRoot() & "db/" & [_DBID_TIME_CLOCK] & "?a=API_AddRecord&_fid_6="&URLEncode ([Record ID#])&"&apptoken=d58b2yeetqfh3d7snhfjdjf7sv2&_fid_xx="&URLEncode(Today());

    "javascript:" &
    "$.get('" & 
    $URL & 
    "',function(){" &
    "location.reload(true);" &
    "});" 
    & "void(0);


  • 4.  RE: Creating a button that creates and populates a new record without opening the record

    Top
    Contributor
    Posted 09-04-2017 18:55
    Ok, Don't feel bad, but....
    in the portion of the formula after the app token where we are putting the "Today" function.

    &apptoken=d58b2yeetqfh3d7snhfjdjf7sv2&_fid_xx="&URLEncode(Today());

    You need to change the "xx" to be the field ID of your date field on the child table.  So if the date field is field id 12 your formula would look like:

    &_fid_12="&URLEncode(Today());


  • 5.  RE: Creating a button that creates and populates a new record without opening the record

    Bronze
    Contributor
    Posted 09-04-2017 19:58
    Lol... I put that in the first ID field, which now explains why it wasn't going into the correct record. Thank you!


  • 6.  RE: Creating a button that creates and populates a new record without opening the record

    Bronze
    Contributor
    Posted 09-04-2017 19:58
    Oh, I should add... It works beautifully!