can we use setworkflow(false) in scheduled jobs?

reeba1
Tera Contributor

Hello,

Can we use setworkflow(false) in scheduled jobs? or is it supposed to be used only in business rules?

Regards,

Reeba

1 ACCEPTED SOLUTION

shruti_tyagi
ServiceNow Employee
ServiceNow Employee

Hey Reeba,


Yes you can use it in any script in scheduled jobs, business rules, script includes. setWorkflow(false) is used to avoid recursion. There are number of OOB scheduled jobs that has setworkflow(false) here are some OOB jobs that has it:


Scheduled Report Summary Generation - First Level Locations: /sysauto_script.do?sys_id=9d39c2a40a0a0b9e00ba658934361fe9


Scheduled Report Summary Generation - Trend of Open Incidents: /sysauto_script.do?sys_id=f4e83be1c0a8016a007d60879d081cbd


Scheduled Report Summary Generation - Trend of Closed Incidents: /sysauto_script.do?sys_id=f4ef3643c0a8016a0074abe30b8ab2d6


Scheduled Report Summary Generation - Incident Backlog: /sysauto_script.do?sys_id=f4f02bc4c0a8016a00b8e60a2588405b


Scheduled Report Summary Generation - First Call Resolution True: /sysauto_script.do?sys_id=fea3b9a70a0a0b9e008ff80468a5f27b


Scheduled Report Summary Generation - First Call Resolution False: /sysauto_script.do?sys_id=fead2af40a0a0b9e00e83ede1ec96f26


Scheduled Report Summary Generation - Incident Backlog For Last Nine Months: /sysauto_script.do?sys_id=feb021a50a0a0b9e00b3bb19cc61f01c



Thanks


Shruti


If the reply was informational, please like, mark as helpful or mark as correct!


View solution in original post

4 REPLIES 4

Shishir Srivast
Mega Sage

Yes, you can use the setworkflow(false) in scheduled jobs to skip the business rules.


shruti_tyagi
ServiceNow Employee
ServiceNow Employee

Hey Reeba,


Yes you can use it in any script in scheduled jobs, business rules, script includes. setWorkflow(false) is used to avoid recursion. There are number of OOB scheduled jobs that has setworkflow(false) here are some OOB jobs that has it:


Scheduled Report Summary Generation - First Level Locations: /sysauto_script.do?sys_id=9d39c2a40a0a0b9e00ba658934361fe9


Scheduled Report Summary Generation - Trend of Open Incidents: /sysauto_script.do?sys_id=f4e83be1c0a8016a007d60879d081cbd


Scheduled Report Summary Generation - Trend of Closed Incidents: /sysauto_script.do?sys_id=f4ef3643c0a8016a0074abe30b8ab2d6


Scheduled Report Summary Generation - Incident Backlog: /sysauto_script.do?sys_id=f4f02bc4c0a8016a00b8e60a2588405b


Scheduled Report Summary Generation - First Call Resolution True: /sysauto_script.do?sys_id=fea3b9a70a0a0b9e008ff80468a5f27b


Scheduled Report Summary Generation - First Call Resolution False: /sysauto_script.do?sys_id=fead2af40a0a0b9e00e83ede1ec96f26


Scheduled Report Summary Generation - Incident Backlog For Last Nine Months: /sysauto_script.do?sys_id=feb021a50a0a0b9e00b3bb19cc61f01c



Thanks


Shruti


If the reply was informational, please like, mark as helpful or mark as correct!


Hello Shruti,



Thankyou for sharing this information.



Regards,


Reeba


Rajesh Mushke
Mega Sage
Mega Sage

Hey Reeba,



Yes, we can use setworkflow(false), it's based on requirement




Thanks,
Rajashekhar Mushke
Rising star : 2022 - 2024
Community Leader -2018
Connect me on LinkedIn : Rajashekhar Mushke