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
SvenSven 

Disable a workflow

Hi all,

 

I am wondering is it possible to disable a workflow via apex code?

a apex trigger or something like that.

 

Thx

 

Sven

Cory CowgillCory Cowgill

No, you cannot disable workflows via Apex code to my knowledge.

 

What you can do is look at your use case, and modify the worklow not to fire for your special logic.

 

Think about it. If your were able to disable a wokflow, its possible you could have multiple transactions occuring at the same time and if you disabled the worklflow in one trigger, that could impact other concurrent transactions which expected the workflow to fire.

SvenSven

Hi Cory

 

Thx for the reply. I also thought about a mechanism to add in my workflow so that i can run or not run. But my use case is a bit different

i want the trigger on a certain custom object and lets say that the outcome of that trigger is true i want to disable a workflow on a totally different custom object so that it won't run in the future. 

 

But i will try to find a solution by updating a field or anything like that where the workflow can check on.

 

Thx for the reply

 

Greets

Sven