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
JoshGuiJoshGui 

Change OwnerID in Trigger

Does anybody have any recommendations or experience with changing the Owner using a Trigger (versus a workflow rule)?  I've setup a trigger that automatically "Submits" to an Approval Process based on the Owner of the record, but it looks like the trigger fires off the approval to the current owner before a Workflow rule can change the owner to who i'd like.  I don't even mind if I have to hardcode the preferred ownerid into the trigger.

Pradeep_NavatarPradeep_Navatar

In Salesforce the order of execution is :

 

  1. System Validation Rules
  2. Custom Validation Rules
  3. Triggers
  4. Assignment rules
  5. Auto response rules
  6. Workflows
  7. Escalation rules
  8. Send emails

 

So you have to redesign your trigger and workflow. Hope this helps.