Button to Update field AND save and view record?
Hey Y'all!
So, I have a form, and I want a button that is "submit for approval", in a form. When it's clicked, I want it to 1: select the "submit for approval" field and 2: save the form and display the newly created record in view mode. I got part one down with this URL Field code (from magic buttons):
If([Submit For Approval] = false,
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxxx" &
"&_fid_40=1" & //this is the checkbox field
"&saverecord=true" &
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]),
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" &
"&rid=" & [Record ID#] &
"&apptoken=xxxxxxxxxx" &
"&_fid_40=0" & //this is the checkbox field
"&saverecord=true" &
"&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]))
However, clicking the button brings up this error screen:
However however, the record is still submitted and is viewable in the app. So, I kind of think the code is trying to reference the Record ID before it's created? Anyway, anybody know how to make this work? I've looked in these forums, asked ChatGPT a bunch of times, and spent time scrolling through Magic Buttons, and no dice.
------------------------------
Thomas Otten
------------------------------