Prioritizing/Delaying Multiple Actions

Essentially my problem has 3 potential solutions, but I will start with the one I’d most like to learn about (the title).

Problem: My button has multiple actions, but the main ones in this situation are:

  • There is a custom picklist for “Country Reassign”, which after being saved, will run a WF rule that updates the standard Country field to this new value (we would use the Country field if it was picklist, but it is String)
  • Sets Lead Owner to “Holding Queue” - this will fire Apex code that assigns the lead to a specific queue and then user based on routing and assignment logic rules
  • Sets my two custom picklists (a Yes/No and the above Country Reassign) to null, so they will be clear in case reassignment is needed (not too important, but would be nice), saves the model, and closes the popup where these fields are located
When I save the model, the Apex routing logic runs to assign the lead at the same time the field update runs. The field update needs to run and update the Country before the Apex routing logic begins, or else it will be incorrect. If you click reassign again it always is assigned correctly.

  1. Find a way to run the WF field update as part of my multiple actions (Apex code runs last)
  2. Make the reassignment a two step process (save the model and let all WF rules fire), then have another button that fires Apex (prefer not to do this, but I know it will work)
  3. Update the standard Country field with the custom “Country Reassign” value within Skuid and skip the WF rule (is there a way to do this without a JS snippet - Update Field and set the value to “Country_Reassign__c”? and also be able to clear the picklists AFTER they update the field)
A solution for #1 would be ideal, although I realize it’s more of a SFDC than Skuid issue. But it would be a more scalable solution for us in the long-term (since we have many processes similar to this). #2 I can already do. #3 would be good to know as well.

Thanks and Happy New Year!

I realized that #3 is extremely simple. But I’d still be curious if #1 is possible.

Solution 1 is a perfectly good solution. In the multiple actions, you first save the model that has the workflow then you have a snippet that fires the Apex via a remote action. This should work fine.