I have a question about data brought in from a webhook.
I have two scenarios:
Scenario A - Adds deal to a Data Store when won in Pipedrive
Scenario B - when the same Pipedrive deal is won, checks Data Store that the deal exists, then makes a project in Asana and Toggl, then populates Data Store with the project IDs for each (Asana/Toggl). If no deal in Data Store scenario stops.
The issue is that if Scenario B runs first it stops because the deal does not exist in the Data store.
Can I delay the running of Scenario B, allowing Scenario A to run and populate the Data Store?
PS Scenario B attached - note blue path I added if deal does not exist in Data store, it is added, but then the webhook has fired and it doesn’t run back through the red path to create projects in my other tools…
hey @Malkier there are a couple of options that I would try here.
you could trigger Scenario B from Scenario A. (if Scenario B is triggered from a webhook then you can call the webhook at end of scenario A using the HTTP module) And you can use POST to provide any or all the relevant data from the original webhook trigger.
you can put a ‘sleep’ module in Scenario B to sleep for as long as Scenario A takes to finish (this is a bit more of guess work as you don’t know exactly how long Scenario A will take, but depending on how responsive the scenarios need to run you can sleep for longer than the average time Scenario a takes just to ensure the data will be in data store
you can add a ‘sleep’/retry loop in scenario b that keeps retrying to get the data store until its there. (I would add a sleep module here as well) so it tries every 5 or 10 seconds. You want to set some limit of repeater until the datastore record is found. This is the trickiest as you will have to set a variable module and get it to know when you’ve actually found the datastore object. But it could be combined with option 2 nicely to ensure scenario B continues to try until the data store record is there.
Great! Thanks for that input. I wasn’t sure about the set-up steps for Option 1 (is there a good resource for this? I had a look at the Knowledge Base but it wasn’t immediately clear how I would do this.)
In the end I opted for Option 2 as Scenario A is pretty quick. I wasn’t aware of the Sleep module - so thanks! Works a treat!
Re; option 1 tutorial, I don’t have one handy, there are a couple examples here in the community, but they are pretty complex. I think this comes up a lot though, so I think it would be worth posting as part of a tutorial/best-practice.