An action to create a record, wait for workflows to trigger, then delete the record

Hello!

I’m trying to chain together a series of actions (row action on Campaign table):

  1. Create a Contact
  2. Create a Campaign Member linking Contact with Campaign
  3. Delete the Contact
In between 2 and 3 I’d like to wait a while so that a workflow is triggered and an Outbound Message gets sent.

At the moment, the workflow doesn’t trigger because Skuid’s just tooo g’darn’ fast and, I’m guessing, deletes the record before Salesforce has worked out what day of the week it is…

So - is there any way of waiting around a little while in between 2 and 3? I’ve tried putting point 3 as an action on the model instead - no dice.

Cheers!

Louis



Probably not ideal, but you could run a quick javascript snippet between 2 and 3 with
setTimeout(2000) (or however many milliseconds you want to wait).

That’s a good idea - I’ll give it a go. Cheers Matt.

I’m usually opposed to forcing the user to wait an arbitrary time interval, or trying to guess how many milliseconds to wait arbitrarily, but Matt’s approach is a fairly simple one. Another approach would be to still use a setTimeout, but with a shorter interval, e.g. 500 ms, and to re-query your Model until certain conditions are met — i.e. if there is a Boolean flag on your record that indicates that the Outbound Message processing has completed, wait until this flag is true, and then proceed with deleting the record. If you don’t do this, you run the risk of deleting the record before the workflows trigger…

Definitely better if there’s some kind of field change or other indication that you can watch for. Nice idea, Zach.

Good idea - I’ll add a field update to my workflow, I can then loop through using the snippet and delete once flagged.

Cheers guys!

We are totally adding this quote to our marketing: 

 Skuid’s just tooo g’darn’ fast and, I’m guessing, deletes the record before Salesforce has worked out what day of the week it is…