Skip to main content
Question

API Button to Edit Multiple Child Records at the same time

  • May 19, 2023
  • 0 replies
  • 176 views

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
------------------------------

This topic has been closed for replies.

MarkShnierYou
Forum|alt.badge.img+24

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
------------------------------