1

I know that there is no particular order for the workflow execution, but is there any way I could write a formula to get it done like (Record creation time + add some seconds), or any workaround. Any help is appreciated. Thanks.

  • You can use time dependent workflow for delay execution.Every time record is created will still allow to use time dependent workflow – Mohith Shrivastava Jan 4 '14 at 5:19
  • Time dependents are hourly, I need to run my workflows immediately. – cartman Jan 4 '14 at 5:51
  • I think then you will have to use a scheduler class for your logic – Mohith Shrivastava Jan 4 '14 at 8:22
  • 3
    If you need "few (mili)seconds after the main action happened" you might decide to move some logic from workflow rules to Apex method that'd be marked as @future and call it in a trigger for example... Can you write a bit more about your requirement? What action has to be slightly delayed? Some outbound message? – eyescream Jan 4 '14 at 8:37
  • eyescream: I need to send an email with all the details that user enters but one field should not be stored in salesforce, so what Iam trying to do is send an email alert as soon as record is created and I want to update the field back to null after that. I would really appreciate if you can show me some sample code on how to write @future method or if there is any workaround for my requirement.Thanks. – cartman Jan 4 '14 at 15:16
3

There is some ordering to workflow actions - as per this help topic:

https://help.salesforce.com/apex/HTViewHelpDoc?id=workflow_rules_considerations.htm&language=en

"The order in which individual actions and types of actions are executed is not guaranteed. However, field update actions are executed first, followed by other actions."

I have seen anecdotal evidence that workflow rules fire in the order that they were created - don't rely on this as Salesforce staff have said in the past that this isn't the case.

If you need ordering to the evaluation of the rules and/or actions that are fired, you'll need to write your business logic in an apex trigger rather than a workflow. That way you'll have full control.

0

Yes, you can use time dependent workflow rule. Here are few examples. on how to use workflow rules with time dependency.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.