after save model actions and workflow rules

  • 1
  • Question
  • Updated 2 years ago
I save a model.
I have workflow rules in SFDC that are triggered by the model save, and I have model actions in Skuid that are triggered by the model save.

What will happen first?
Is there a way that I can ensure that field updates based on workflow rules will be complete before I run some javascript from a model save action?
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb

Posted 3 years ago

  • 1
Photo of mB Pat Vachon

mB Pat Vachon, Champion

  • 42,714 Points 20k badge 2x thumb
Fairly certain workflow runs before any other following DML requests are made.

Here's a link I found about this. https://help.salesforce.com/HTViewSol...
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Sweet. Thanks, Pat!
Photo of Irvin Waldman

Irvin Waldman, Champion

  • 9,006 Points 5k badge 2x thumb
Matt,  Remember that workflow rules run server side whereas Skuid events are client side.  I would expect Skuid events to occur AFTER the Salesforce has completed its processing.  Great question.
Photo of Rob Hatch

Rob Hatch, Official Rep

  • 44,006 Points 20k badge 2x thumb
Ben looked far off and squinted when asked this question.  After thinking it through,  he said that model save actions don't fire until the model save has been successful.  This means that all the Server side actions associated with model save will occur before the model action fires. 

I concur with Irvin:  Great Question.
(Edited)
Photo of Sofware Developer Guy

Sofware Developer Guy

  • 1,354 Points 1k badge 2x thumb
So,
So I have a workflow rule that updates a required field.  How will I update the UI so that I don't get the required field not set error.

So essentially what I want is:
1) User fills in form.
2) Save happens.
3) Workflow rule will fire in SF that updates a required field.
4) Required field in UI is filled in automatically.
5) Form Saves correctly

Thanks.
Photo of Matt Sones

Matt Sones, Champion

  • 31,478 Points 20k badge 2x thumb
Probably the easiest way to get around it is to set some kind of default 'dummy' value in the required field in skuid, so that the save can happen. Then your workflow rule will update the field to whatever it ought to be.