Forum Discussion

KellyBianchi's avatar
KellyBianchi
Qrew Assistant Captain
8 years ago

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

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);
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    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.
  • KellyBianchi's avatar
    KellyBianchi
    Qrew Assistant Captain
    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);
  • MCFNeil's avatar
    MCFNeil
    Qrew Captain
    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());
  • KellyBianchi's avatar
    KellyBianchi
    Qrew Assistant Captain
    Lol... I put that in the first ID field, which now explains why it wasn't going into the correct record. Thank you!