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
StenEStenE 

Disable Workflow in batch update

Hi,

 

I have a problem with one of my apps. Hope someone has an solution.

 

I have a batch processes which updates every record in the Lead, Contact and Account objects. Now on every update it also fires the workflows which are defined for these objects. I don't want to fire these workflows as my batch update is a pure maintance batch.

 

How can i stop these workflows from executing?

 

Thanks,

Sten

kiranmutturukiranmutturu

you can't disable the active workflow through apex but as a workaround try to maintain an another boolean field which is default to false.....every  where this should be false and when ever ur batch apex is processed u need to set this as true in the repective update call ... and in the workflow add this field as condition ..like when ever it is false then only it should trigger...

OyeCodeOyeCode

Pretty neat way to stop workflow process move on every trigger is :

 

1. Create a boolean flag _isworkFlowUsed=false;  - set it true once a workflow is used

2. With every next iteration inside the Trigger - make sure if the  _isWorkFlowUsed is true skip the process

 

 

Alternative - yet not preferable way

 

- Take out the workflow logic - into trigger which is not a recommend setting though

 

 

Thanks-

ForceLabs http://www.forcelabs.net/

OyeCodeOyeCode

I am kind of in the same issue and yet coding this. Can anybody provide a sample template here. I got the logic through boolean which I shared any valuable code addition or suggestion would highly be welcomed here