Forum Discussion

MattS's avatar
MattS
Qrew Member
12 months ago

API Button to Edit Multiple Child Records at the same time

Hello,

I'm very new to API Buttons and could use a little bit of help. I'm trying to create a button on the parent table that, when pressed, will update specific fields in the associated child records and then return to the original parent record form. Basically when clicked

General Table Information: I have two tables I'm working with here. The Parent table is [LOCATIONS] and the Child table is [VEG___FLOWER_PLANTS]. So basically, a [LOCATION] has many [VEG___FLOWER_PLANTS].

I've tried this a few ways and I keep getting an error. Here is what I have in my Formula URL:

//edit the Child Record
var text URLONE = URLRoot() & "db/" & [_DBID_VEG___FLOWER_PLANTS]
& "?act=API_EditRecord" & "&rid=" & [Record ID#]
& "&_fid_20=" & URLEncode([Abbreviation])
& "&_fid_23=" & URLEncode("Flowering")
& "&_fid_9=" & URLEncode(Today())
& "&apptoken=b8bt467bv36g6icr3fmfgcwf4c42";

//return to original record and form (opens original record in view form )
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

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

I've also tried this way and continue to receive errors:

//edit the Child Record
var text URLONE = URLRoot() & "db/" & Dbid
& "?act=API_EditRecord" & "&rid=" & [Record ID#]
& "&_fid_20=" & URLEncode([Abbreviation])
& "&_fid_23=" & URLEncode("Flowering")
& "&_fid_9=" & URLEncode(Today())
& "&apptoken=b8bt467bv36g6icr3fmfgcwf4c42";

//return to original record and form (opens original record in view form)
var text URLTWO = URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#];

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


It might be worth noting that fid=20 in the child table is the [Related Location] (parent). So basically I'm trying to change the [related Location] from what it currently is to its abbreviation (which is technically the next location the plants move to).

Am I close or am I completely off base with the way I'm going about this? Any help is appreciated. 

EDIT: I should probably also note that I do not have Application Tokens turned off, so that is why I have an app token listed at the end of var text URLONE. I'm not sure if this is needed or if I've done it correctly.

------------------------------
Matt S
------------------------------

4 Replies

  • I can probably help but I'm confused. Is the button supposed to on the Parent record?   Then if there are many child records, is the button supposed to update all children?



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

      Correct, the button is on the parent table and would be on the parent record form. When clicked it would update a few different fields on all the child records associated with that parent. 

      Hope I explained that better.




      ------------------------------
      Matt S
      ------------------------------
      • MarkShnier__You's avatar
        MarkShnier__You
        Qrew Champion

        Ok so now we understand the challenge. 

        To update multiple records you will need to use a pipeline. 


        The records will take a few seconds to get updated. 


        There is a way to have the record refresh instantly using formula URLs but that would take about an hour of one in one consulting time to set up. 



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