+ Start a Discussion

Disable Workflow in batch update



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?





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...


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




ForceLabs http://www.forcelabs.net/


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