MichaelTamoush
3 years agoQrew Captain
GenAdd Record API then EditAPi unless GenAdd Record is canceled
I am trying to run a genaddrec api, and then an edit record api. However, even if the genaddrec is canceled by the user, the edit record api runs.
Is it possible to ONLY run the edit if the add record is completed? Some sort of if statement? I thought below would work, but the edit record api fires no matter what, which I suppose makes sense since it is all part of the original button push.
var text EditPart =
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#]
& "&apptoken=xxxxxxxxxxxxxxxxxxx"
& "&_fid_22=EMI"
& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);
var text ReplacePart =
URLRoot() & "db/" & Dbid() & "?a=API_GenAddRecordForm"
& "&_fid_15=" & [Record ID#]
& "&_fid_26=" & URLEncode(Today())
& "&_fid_20=" & URLEncode([Serial Number]);
//& "&z=" & Rurl();
"<a style=\"text-decoration:none; background: #7aace0; border-radius: 1000px; color: #ffffff; display: inline-block; padding: 2px 0px; width:120px; text-align: center; text-shadow: none; border: 1px solid #030404; font-size: 12px \"href='"
& $ReplacePart
& "&NextURL=" & URLEncode($EditPart)
& "'>Replace Part (EMI)</a>"
------------------------------
Michael Tamoush
------------------------------
Is it possible to ONLY run the edit if the add record is completed? Some sort of if statement? I thought below would work, but the edit record api fires no matter what, which I suppose makes sense since it is all part of the original button push.
var text EditPart =
URLRoot() & "db/" & Dbid() & "?a=API_EditRecord" & "&rid=" & [Record ID#]
& "&apptoken=xxxxxxxxxxxxxxxxxxx"
& "&_fid_22=EMI"
& "&rdr=" & URLEncode(URLRoot() & "db/" & Dbid() & "?a=dr&rid=" & [Record ID#]);
var text ReplacePart =
URLRoot() & "db/" & Dbid() & "?a=API_GenAddRecordForm"
& "&_fid_15=" & [Record ID#]
& "&_fid_26=" & URLEncode(Today())
& "&_fid_20=" & URLEncode([Serial Number]);
//& "&z=" & Rurl();
"<a style=\"text-decoration:none; background: #7aace0; border-radius: 1000px; color: #ffffff; display: inline-block; padding: 2px 0px; width:120px; text-align: center; text-shadow: none; border: 1px solid #030404; font-size: 12px \"href='"
& $ReplacePart
& "&NextURL=" & URLEncode($EditPart)
& "'>Replace Part (EMI)</a>"
------------------------------
Michael Tamoush
------------------------------