Discussions

Expand all | Collapse all

API-AddRecord

  • 1.  API-AddRecord

    Posted 08-24-2021 13:33
    Hello,
    I am working with the AddRecord API and I have gotten it to the point where the data is added to the correct field but it is added to a new record where every other field is empty. I do not know how to specify within the API code which record the data should be added to. I would like it to be added to the most recently built record but I am having a hard time finding out how to do that. I have attached my code to help clarify the issue. I am also fairly new to coding in QuickBase so if you see anything in this code that is wrong please let me know. Thanks in advance!


    //formatting visuals of button
    var text bgcolor = "#34A853";
    var text txtcolor = "white";
    var text style = "style=\"text-decoration: none; background:" & $bgcolor & "; border-radius: 5px; padding: 8px 20px; color: " & $txtcolor & "; display: inline-block; font: normal 700 24px/1 \"Calibri\", sans-serif; text-align: center; text-shadow: none;";

    //Inner workings of button
    var text url =

    URLRoot() & "db/" & [_DBID_Project] & "?act=API_AddRecord_fid_140=Approved"&[Record ID#]&"&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te" &"&rdr="&URLEncode("https://divisionsinc.quickbase.com/db//brpms6hce?a=dbpage&pageID=19");



    "<a " & $style & " href=\"" & $url & "\">Approve</a>"


    //DBID = Project
    //App Token = uwi4fb9cj4szcdzjnfxd5xz3te
    //Aproval status field ID = 140
    //Thankyou page linke = https://divisionsinc.quickbase.com/db//brpms6hce?a=dbpage&pageID=19

    ------------------------------
    Hank Halverson
    ------------------------------


  • 2.  RE: API-AddRecord

    Posted 08-24-2021 13:39
    np,

    You are in fact trying to edit a record, not Add a record.  So you need to use a different API.

    Try this for the URL
    var text url =
    URLRoot() & "db/" & [_DBID_Project] & "?act=API_EditRecord&rid="  &[Record ID#]
    & "&apptoken=uwi4fb9cj4szcdzjnfxd5xz3te"
    & "&_fid_140=Approved"
    & "&rdr=" & URLEncode("https://divisionsinc.quickbase.com/db//brpms6hce?a=dbpage&pageID=19");


    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------