Forum Discussion

ChristineWhite's avatar
ChristineWhite
Qrew Assistant Captain
5 years ago

1 Button to update fields in two apps

I successfully created a button that updates fields in App2 from App1 but am wondering if I can also use this same button to update fields in App1.   i.e. can a 2nd URLRoot statement be added to this for App1?

Thanks!

var text URL = URLRoot() & "db/" & "App2ID" & "?act=API_EditRecord&rid=" & [App2Record ID]
& "&_fid_994=" & Now()
& "&_fid_992=Note from " & UserToName(User())
& "&apptoken=xxxxxxxxxxxxxxx";

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

------------------------------
Christine White
------------------------------
  • There may be Syntax which exists to do multiple API calls and refresh the page, but if so, the syntax is brutally confusing.

    This Syntax is simpler to next successive calls but has the disadvantage that the last step needs to be to land the user on a record or a report, meaning that the same button cannot be used on a record and a random report.

    $URLONE
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))
    & URLEncode(URLEncode("&rdr=" & URLEncode($URLFOUR)))
    & URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLFIVE))))
    & URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSIX)))))
    & URLEncode(URLEncode(URLEncode(URLEncode(URLEncode("&rdr=" & URLEncode($URLSEVEN))))))



    So in you case you need three slices off that salami

    var text URLONE = URLRoot() & "db/" & "App2ID" & "?act=API_EditRecord&rid=" & [App2Record ID]
    & "&_fid_994=" & Now()
    & "&_fid_992=Note from " & UserToName(User())
    & "&apptoken=xxxxxxxxxxxxxxx";

    var text URLTWO = URLRoot() & "db/" & "App1ID" & "?act=API_EditRecord&rid=" & [App2Record ID]
    do something else
    & "&apptoken=xxxxxxxxxxxxxxx";

    var text URLTHREE = URLRoot(0 & "db/" & dbid() & "?a=dr&rid=" & [Record ID#];

    $URLONE
    & "&rdr=" & URLEncode($URLTWO)
    & URLEncode("&rdr=" & URLEncode($URLTHREE))


    The Product Managers at Quick Base are aware that doing all this stuff is not really "no code low code" and there are plans on the Product Roadmap in the medium term to allow us to execute APIs, hopefully successive APIs,  and refresh the screen without the use of javascript.  The don't like us using Javascript as its a security loophole, but they also realize they need ot provide an alternative.





    ------------------------------
    Mark Shnier (YQC)
    Quick Base Solution Provider
    Your Quick Base Coach
    http://QuickBaseCoach.com
    mark.shnier@gmail.com
    ------------------------------
    • ChristineWhite's avatar
      ChristineWhite
      Qrew Assistant Captain
      Thank you, I tried updating my button to the following.  URLGOLD worked but not URLULH.  Did I add to the javascript code correctly?

      var text URLGOLD = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Project ID#] &
      "&_fid_1778=" & URLEncode(Now()) &
      "&_fid_1779=" & ToText(User()) &
      "&apptoken=xxxxxxxxxxxxxxx";

      var text URLULH=URLRoot() & "db/" & "ULHAPPID" & "?act=API_EditRecord&rid=" & [VZULH App Record ID]
      & "&_fid_994=" & Now()
      & "&_fid_992=" & Now() & " IRM Ready for Review per " & UserToName(User())
      & "&apptoken=xxxxxxxxxxxxxxxxxx";

      var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Project ID#];


      "javascript:" &
      "$.get('" &
      $URLGOLD
      & "&rdr=" & URLEncode($URLULH)
      & URLEncode("&rdr=" & URLEncode($URLTHREE))&
      "',function(){" &
      "location.reload();"&
      "});" &
      "void(0);"

      ------------------------------
      Christine White
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend
        No, that was my point.  You cannot use the javascript refresh method with multiple API calls.  or, at least if you can,  the syntax is brutal.

        var text URLGOLD = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Project ID#] &
        "&_fid_1778=" & URLEncode(Now()) &
        "&_fid_1779=" & ToText(User()) &
        "&apptoken=xxxxxxxxxxxxxxx";

        var text URLULH=URLRoot() & "db/" & "ULHAPPID" & "?act=API_EditRecord&rid=" & [VZULH App Record ID]
        & "&_fid_994=" & Now()
        & "&_fid_992=" & Now() & " IRM Ready for Review per " & UserToName(User())
        & "&apptoken=xxxxxxxxxxxxxxxxxx";

        var text URLTHREE = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Project ID#];

        $URLGOLD
        & "&rdr=" & URLEncode($URLULH)
        & URLEncode("&rdr=" & URLEncode($URLTHREE))





        ------------------------------
        Mark Shnier (YQC)
        Quick Base Solution Provider
        Your Quick Base Coach
        http://QuickBaseCoach.com
        mark.shnier@gmail.com
        ------------------------------