I need to call the API_EditRecord API to conditionally check or uncheck a series of checkboxes. I have a button like this:I need to call the API_EditRecord API to conditionally check or uncheck a series of checkboxes. I have a button like this:
var text clearAll = "_fid_3134=0" & If([Service1] and [Service1 Completion Status] = "", "&_fid_3008=10") & If([Service2] and [Service2 Completion Status] = "", "&_fid_3009=0") & If([Service3] and [Service3 - Completion Status] = "", "&_fid_3010=0") & If([Service4] and [Service4 - Completion Status] = "", "&_fid_3011=0") & If([Service5] and [Service5 Completion Status] = "", "&_fid_3012=0") & If([Service6] and [Service6 - Completion Status] = "", "&_fid_3355=0") & If([Service7] and [Service7 - Completion Status] = "", "&_fid_3095=0") & If([Service8] and [Service8 Completion Status] = "", "&_fid_3017=0") & If([Service9] and [Service9 Completion Status] = "", "&_fid_3016=0") & If([Service10] and [Service10 Completion Status] = "", "&_fid_3013=0") & If([Service11] and [Service11 - Completion Status] = "", "&_fid_3084=0") & If([Service12] and [Service12 - Completion Status] = "", "&_fid_3085=0") & If([Service13] and [Service13 Completion Status] = "", "&_fid_3015=0") & If([Service14] and [Service14 Completion Status] = "", "&_fid_3018=0") & If([Service15] and [Service15 - Completion Status] = "", "&_fid_3019=0") & If([Service16] and [Service16 Completion Status] = "", "&_fid_3007=0") & If([Service17] and [Service17 Completion Status] = "", "&_fid_3020=0") & If([Service18] and [Service18 Completion Status] = "", "&_fid_3021=0") & If([Service19] and [Service19 - Completion Status] = "", "&_fid_3074=0");
var text submitAll = "_fid_3134=1" & If([Service1], "&_fid_3008=1") & If([Service2], "&_fid_3009=1") & If([Service3], "&_fid_3010=1") & If([Service4], "&_fid_3011=1") & If([Service5], "&_fid_3012=1") & If([Service6], "&_fid_3355=1") & If([Service7], "&_fid_3095=1") & If([Service8], "&_fid_3017=1") & If([Service9], "&_fid_3016=1") & If([Service10], "&_fid_3013=1") & If([Service11], "&_fid_3084=1") & If([Service12], "&_fid_3085=1") & If([Service13], "&_fid_3015=1") & If([Service14], "&_fid_3018=1") & If([Service15], "&_fid_3019=1") & If([Service16], "&_fid_3007=1") & If([Service17], "&_fid_3020=1") & If([Service18], "&_fid_3021=1") & If([Service19], "&_fid_3074=1"); var text urlyes = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] & "&apptoken=token&" & $submitAll;
var text urlno = URLRoot() & "db/" & Dbid() & "?act=API_EditRecord&rid=" & [Record ID#] & "&apptoken=token&" & $clearAll;
If([Submit All],
"<a style=\" text-decoration: none; background: #008000; border-radius: 5px; color: #fff; display: inline-block; width: 190px; text-align: center; padding: 8px 20px; font: normal 700 10px/1 \"Calibri\", sans-serif; text-shadow: none; \" href='" & $urlno & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) &"'>All Submitted</a>",
"<a style=\" text-decoration: none; background: #D7D4D3; border-radius: 5px; color: #000; display: inline-block; width: 190px; text-align: center; padding: 8px 20px; font: normal 700 10px/1 \"Calibri\", sans-serif; text-shadow: none; \" href='" & $urlyes & "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=er&rid=" & [Record ID#]) &"'>Not Submitted</a>") The button has been tested and works as desired. I would also like to be able to make the same API call when the checkbox is checked in a single or multiple records in Grid Edit.
------------------------------
Paul Peterson
------------------------------