Forum Discussion

manoharvankired's avatar
manoharvankired
Qrew Trainee
2 years ago

how to pass child table value to parent table in quickbase using API formula

I am attempting to update a status field in the parent table when a user clicks the API button from the child table. I have used the following formula, but I received an error stating 'Missing "rid" parameter.' Additionally, I would like to hide the API button from the child table when the user clicks on it

var text EditUser = URLRoot() & "db/" & [_DBID_ON_HOLD_TASKS] & "?act=API_EditRecord"
& "&rid=" & [Record ID#] & "&_fid_6=" & Now(); // Chlid table

var text AddUser = URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=API_EditRecord"
& "&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np"
& "&_fid_45=" & URLEncode("Task OnHold"); // Parent table

If(IsNull([On Hold Start Date]),
$AddUser & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_INPROGRESS] & "?a=dr&rid=" & [Record ID#]),
$EditUser & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_ON_HOLD_TASKS] & "?a=dr&rid=" & [Record ID#]))



------------------------------
manohar vankireddy
------------------------------
  • For this line here

    var text AddUser = URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=API_EditRecord"
    & "&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np"
    & "&_fid_45=" & URLEncode("Task OnHold"); // Parent table

    you are telling it to edit a record, but you have not specified, which record to edit. So it needs a &rid= parameter, maybe like

    "&rid=" & [related parent]



    ------------------------------
    Mark Shnier (Your Quickbase Coach)
    mark.shnier@gmail.com
    ------------------------------
    • manoharvankired's avatar
      manoharvankired
      Qrew Trainee

      As Discussed, Updated the formula. Now Child table date is update but Parent table Status is not updating and API button is not disabled in the child table

      var text EditChildRecord = URLRoot() & "db/" & [_DBID_ON_HOLD_TASKS] & "?act=API_EditRecord"
      & "&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np"
      & "&rid=" & [Record ID#] & "&_fid_6=" & Now();

      var text EditParentRecord = URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=API_EditRecord"
      & "&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np"
      & "&_fid_45=" & URLEncode("Task OnHold")
      & "&rid=" & [Record ID#];

      If(IsNull([On Hold Start Date]),
      $EditChildRecord & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_ON_HOLD_TASKS] & "?a=dr&rid=" & [Record ID#]),
      $EditParentRecord & "&rdr=" & URLEncode(URLRoot() & "db/" & [_DBID_INPROGRESS] & "?a=dr&rid=" & [Record ID#]))



      ------------------------------
      manohar vankireddy
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Icon for Qrew Legend rankQrew Legend

        The problem is here

        var text EditParentRecord = URLRoot() & "db/" & [_DBID_INPROGRESS] & "?act=API_EditRecord"
        & "&apptoken=dpvtvtrbuvtrjjd5ydp38bccn9np"
        & "&_fid_45=" & URLEncode("Task OnHold")
        & "&rid=" & [Record ID#];

        your button is on the child record. Therefore the record ID that you are trying to edit on the parent record is not the record ID of the child but rather the record ID of the parent record  

        That Line needs to read something like this.  

        & "&rid=" & [Related Parent];



        ------------------------------
        Mark Shnier (Your Quickbase Coach)
        mark.shnier@gmail.com
        ------------------------------