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
vreddyvreddy 

Invoke Trigger or Workflow from Apex Class

Hi all,

 

Can we make Workflow / Trigger to fire from Apex class on something like field updates (does not matter even if some additional unnecessary things to be done in between to achieve this ).  I know I am asking a weird question!

 

Thanks!!!

Anand@SAASAnand@SAAS

If the workflow needs to be executed on a different object than what the tirgger is written against, the answer is "Yes". If the workflow is written on the same object as the trigger, the answer is "maybe" as you might run into some conditions that might throw an error.

vreddyvreddy

Thanks for the reply.

If I understood correctly what you are saying, "It is possible to make the Workflow execute from an Apex class".

Can you please explain a bit detail how?

 

Anand@SAASAnand@SAAS

The apex class needs to update a record that will in turn execute a workflow. It woudl help to understand what exactly are you are trying to acheive as there might be a better way to do this.

 

vreddyvreddy

Thank You very much!!!  That is it. Reason behind posting this: I was not sure about record updates through apex would fire workflow.  I thought, only the changes made through user interface would.