function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SAHG-SFDCSAHG-SFDC 

Order of Execution-Workflow and Triggers

Hi,

I am trying to send an email to the users of a queue, depending on the criteria  I have to send the email, I have a trigger which send it rightly to the queue and a workflow which (email Alert)

I see that the order is reversed, i.e. workflow going first and then trigger thereby not sending the email, If I manually route it works

Please assist!
Kiran RKiran R
Correct me if i did not understand your problem right. You were trying to send an email to a queue through a wf rule. But, the Queue has to be updated on the record by a trigger. Assuming this is the case, Following should work:

If you make your workflow criteria to run only of it sees the Queue populated and send it 'Evarytime updated to subsequently meet the criteria', The workflow should come around and send that email for you.
SAHG-SFDCSAHG-SFDC
Thanks for responding

My workflow rule entry is to send an email(Using a template that I have created) alert when the new lead comes in to the queue they are assigned to
The Trigger is routing the lead to the right Queue

On the UI, I see the order is correct (It is routing to the right queue ) under the history on lead it is visible, where as in debug log it looks different and I am not getting email as well
SAHG-SFDCSAHG-SFDC
The order is different I guess, The workflow is executing first and then the trigger is executing, And that is the reason I am not getting an email
Kiran RKiran R
Couple of checks:
  1. Evaluate the rule when a record is: "created, and every time it's edited". This should make the workflow run twice
  2. In the setup search for "Email Administration". Click on the "Deliverability". Veify the Access level is set to 'All Email'.
  3. Finally, The User should have the access to the Email Template's Folder in which your template is placed at.
After doing all the above, It should work.
SAHG-SFDCSAHG-SFDC
Hi Kiran,

Yes, all the above conditions are true

 
SAHG-SFDCSAHG-SFDC
Our setup is like this

Leads come in from Eloqua/Bulk Upload to SFDC
                           | 
We route them to a Global Queue (This is using assignment rules)
                           |
We send it to the individual partner Queue (This is using Trigger)
                           |
We send an email to the partners that the leads came in to their Queue


This is the flow. Problem is  not getting an email as a flow, Non manual way is once the lead comes it its suppose to flow and send an email with out the user manually changing the owenership