Forum Discussion

DanielJohnson2's avatar
DanielJohnson2
Qrew Trainee
3 years ago

Trigger Pipeline when Record Updated Only in Edit Mode?

Hi All,

I inherited an app that has a heavily used API button on a grid edit report. Clicking the button triggers the API, which triggers a webhook that changes a field call Contact Status on that record. The webhook also logs that change in an activity log field that has "Log the edits to this field, and show them on forms" turned on. Most users use this button to log contact activity. However, some users enter the record in edit mode and toggle the Contact Status field to one of its choices. The API and webhook don't fire on this occasion, failing to log the activity. I was hoping to build a pipeline to log this activity, but I'm getting stuck on the trigger. I thought setting the pipeline to fire when the record is updated would do the trick. So I set that up, and Step B was to update the record with a timestamp and some other info captured. This worked when I changed the record's Contact Status from edit mode. However, it also fired when the API button was clicked, thus logging the same activity twice.

Is there a way to have the pipeline only fire when the record is changed only from edit mode? Or, is there some sort of formula field I could create that's a true/false that's true only if the Contact Status field was changed from edit mode? That would allow me to work that true/false field into the condition for the pipeline.

Thoughts?

Thanks

------------------------------
Daniel Johnson
------------------------------

6 Replies

  • I can think of two possible solutions, perhaps other people can think of even better ones.

    1. Chang the API button to ONLY select the status field. Then let the Pipeline do all of the other steps that the API and webhook normally did. Pipeline trigger would be when the Change Status field is modified.

    2. Create a checkbox called 'Triggered From Button Push'. Modify your button so when it does the edit record, it also checks this box. Then in your pipeline, create an if statement after the initial trigger. If 'Triggered from button push'=false, run the webhook and API equivalent items. If 'triggered from button push'=true, then all it does is uncheck the 'triggered from button push' checkbox.

    ------------------------------
    Mike Tamoush
    ------------------------------
    • DanielJohnson2's avatar
      DanielJohnson2
      Qrew Trainee
      Hey Mike,

      Thanks for the response. I tried your first suggestion, but the problem there is that there are scenarios where the same activity has to be logged twice in a row, and the pipeline wasn't getting triggered when that happened. So, let's say the Contact Status field was already set to Email, and the user sent another email, clicking the button that triggers the webhook wasn't triggering the pipeline. I guess because the field the pipeline was triggering off of wasn't updating? The same thing would happen with your second suggestion because it's possible the user clicks the same button consecutively. Thoughts?

      ------------------------------
      Daniel Johnson
      ------------------------------
      • MichaelTamoush's avatar
        MichaelTamoush
        Qrew Captain
        There may be some solutions the way we were heading, but knowing this it seems that the people really need to push the button, so the 'Keep it Simple' approach would be to force them to push the button.

        From your original scenario, what if you went a simpler route? What if you put things back the way they were, then set up your form so in edit/add mode you don't even show the contact status field? So it's not even possible for someone to go in edit mode and change the status? If you wanted,  in edit mode you could show the button, so they are forced to press the button in any scenario. Or you could display a message in edit mode only 'Please return to the table report to set the status'. You could also make the change status field read only, and in the info bubble write 'Please use the table report to set this field'. Etc...lots of ways to lock people out of setting the status in edit mode.

        ------------------------------
        Mike Tamoush
        ------------------------------