Discussions

Expand all | Collapse all

Error from URL Formula

  • 1.  Error from URL Formula

    Posted 01-07-2020 13:48
    What have I done wrong (I suck at these)?
    I have created this formula:
    var text URLONE = URLRoot() & "db/" & Dbid()

    & "?act=API_EditRecord&rid=" & [Record ID#] &

    "&_fid_8=" & Today() &

    "&_fid_9="& URLEncode("RECEIVED");

    $URLONE

    And I am getting this error:

    <qdbapi>
    <action>API_EditRecord</action>
    <errcode>0</errcode>
    <errtext>No error</errtext>
    <rid>1</rid>
    <num_fields_changed>0</num_fields_changed>
    <update_id>1578420560656</update_id>
    </qdbapi>


    ------------------------------
    George Bramhall
    ------------------------------


  • 2.  RE: Error from URL Formula

    Posted 01-07-2020 14:11
    Does your app have tokens enabled? If yes, then you need to add the token to your API.

    Try this with your token added in place of the X's:

    var text URLONE = URLRoot() & "db/" & Dbid()

    & "?act=API_EditRecord&apptoken=XXXXXXXXXXXXXXXXXX&rid=" & [Record ID#] &

    "&_fid_8=" & Today() &

    "&_fid_9="& URLEncode("RECEIVED");

    $URLONE

    ------------------------------
    Adam Keever
    ------------------------------



  • 3.  RE: Error from URL Formula

    Posted 01-07-2020 15:32
    Thanks but I have tokens disabled. I figured out that I needed some javascript to reload where I left off.
    Here is the formula that works with the javascript:
    var text URLONE = URLRoot() & "db/" & Dbid()

    & "?act=API_EditRecord&rid=" & [Record ID#] &

    "&_fid_8=" & Today() &

    "&_fid_9="& URLEncode("RECEIVED");

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

    ------------------------------
    George Bramhall
    ------------------------------



  • 4.  RE: Error from URL Formula

    Posted 01-07-2020 15:42
    Good news. Way to stick with it!

    ------------------------------
    Adam Keever
    ------------------------------



  • 5.  RE: Error from URL Formula

    Posted 01-07-2020 18:14
    Little tip - if you ever plan on having a Date/Time field to fill in from a button use this URLEncode("today"). It will drop in the current time along with the date.

    ------------------------------
    jason johnson
    ------------------------------



  • 6.  RE: Error from URL Formula

    Posted 01-07-2020 20:12
    Hi George!

    You don't necessarily need Javascript, just an "rdr" redirect.

    URLRoot() & "db/" & Dbid() &
    "?act=API_EditRecord&rid=" & [Record ID#] &

    "&_fid_8=" & Today() &
    "&_fid_9="& "RECEIVED" &
    "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#] )

    ^^ or you can set the location to somewhere else in your app by adjusting what comes after the "?"

    If you want to learn the ins and outs of building APIs for Quick Base Buttons you can check out a course I offer here.

    ------------------------------
    Sharon Faust (QuickBaseJunkie.com)
    Founder, Quick Base Junkie
    https://quickbasejunkie.com
    ------------------------------



  • 7.  RE: Error from URL Formula

    Posted 01-07-2020 20:18
    One of advantage of the JavaScript refresh syntax is that it will refresh the page that you are on, so that means that it will refresh either the record or the report that you are on as opposed to dropping the user necessarily back on displaying the record.
    So for example if there were a whole series of records to mark as  received on a report of Open receiving you could just keep clicking the ones that you've received on the report would refresh one record shorter after every click. 


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



  • 8.  RE: Error from URL Formula

    Posted 01-08-2020 11:25
    or if you are using it on a dashboard

    ------------------------------
    Jason Johnson
    ------------------------------