Discussions

Expand all | Collapse all

Help with URL Button to add child record and then save automatically

  • 1.  Help with URL Button to add child record and then save automatically

    Posted 05-02-2019 15:08
    Hi,

    I have a URL formula button to add a child record and pre-populate fields. Is it possible to have this button automatically save the child record as well without it opening the new child record and having to save it there?
    I did my best to research these forums, but couldn't find a solution. I realize I could achieve this with a checkbox and QB automation, but I'd rather have a button for this.

    Here is my current formula
    URLRoot() & "db/" & [_DBID_ACTIVITIES] & "?a=API_GenAddRecordForm&_fid_38=" & URLEncode ([Record ID#])
    & "&_fid_6=" & "Mailed Letter"
    & "&_fid_125=" & "Birthday"
    & "&_fid_23=" & "Outreach"
    & "&z=" & Rurl()

    Appreciate any help.


  • 2.  RE: Help with URL Button to add child record and then save automatically

    Posted 05-02-2019 15:32
    np,

    But the question is where to return the user to once you save the record. 

    This code will add the child and refresh the record you are sitting on.  Presumably that is the Parent record and the user will then see the child an an embedded child record on the parent so they will know that the button worked.

    Note that this API is AddRecord instead of GenAddRecordForm



    var text URL = URLRoot() & "db/" & [_DBID_ACTIVITIES] & "?a=API_AddRecord&_fid_38=" & URLEncode ([Record ID#])
    & "&apptoken=xxxxxxxxxx"
    & "&_fid_6=" & "Mailed Letter"
    & "&_fid_125=" & "Birthday"
    & "&_fid_23=" & "Outreach"

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


    When you do an API like this you either need to disable the need for Application Tokens, which you find in Settings for the App and then App properties, or else you need to create an Application Token and supply it.  That s an extra layer of security and its not for me really so suggest that you don't need it, but most of my client don't bother with that extra layer of security. https://help.quickbase.com/user-assistance/app_tokens.html





  • 3.  RE: Help with URL Button to add child record and then save automatically

    Posted 05-02-2019 15:50
    Thank you for the info. To answer your question, this button would actually be on a report so I'd like it to reload back to that report. This report also displays the last activity created, so the user will be able to verify that the button worked.

    EDIT: I defined $URL to the report, but am met with an error page. However, the record did save properly.
    ERROR: "This XML file does not appear to have any style information associated with it. The document tree is shown below.


  • 4.  RE: Help with URL Button to add child record and then save automatically

    Posted 05-02-2019 16:00
    That was not an error, that in fact was the XML Success message- which admittedly is not friendly.

    i suspect that you did not use by whole formula.  :)

    You did not use that javascript stuff which will refresh the page and hide the message.


  • 5.  RE: Help with URL Button to add child record and then save automatically

    Posted 05-02-2019 16:56
    Your suspicion is correct :)

    Thank you sir!