+ Start a Discussion
srikanth j 24srikanth j 24 

Salesforce Workflow,Trigger

Hi guys,
I have 1 scenario using workflow i need to update 1 field based on some criteria and using Trigger i need to update same object and same field how can i achieve this can anyone help me out.if possible send me code.
Thanks in Advance
Preya VaishnaviPreya Vaishnavi
Let me know if the criteria of the trigger and workflow are different.This can be achieved by creating workflow and trigger.Please check the below flow of execution
  1. Executes workflow rules.
  2. If there are workflow field updates, updates the record again.
  3. If the record was updated with workflow field updates, fires before update triggers and after update triggers one more time (and only one more time), in addition to standard validations. Custom validation rules, duplicate rules, and escalation rules are not run again.

The link for the order of execution

https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_triggers_order_of_execution.htm