Forum Discussion

MichaelTamoush's avatar
MichaelTamoush
Qrew Captain
3 years ago

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
------------------------------
  • Can you do the API edit by an automation or a pipeline? That way it would only fire when it really needed to.

    ------------------------------
    Mark Shnier (YQC)
    mark.shnier@gmail.com
    ------------------------------
    • MichaelTamoush's avatar
      MichaelTamoush
      Qrew Captain
      Actually yes i can. I can build a checkbox trigger into the Add Rec part, which wouldnt be checked if it was cancelled. That should work - good idea. I was hoping there was a way to say If GenAddRec is saved, then......fire edit api

      ------------------------------
      Michael Tamoush
      ------------------------------