- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago - last edited a month ago
Hi
I created a fix script to cancel incident records and used setWorkflow(false) within the script.
When I executed it, the incidents were marked as "Cancelled," but they all remained active due to the setWorkflow(false) setting.
Now, I'm trying to set the active field to false, but it’s not working. Even when I manually or by script try to update the field, it automatically reverts back to true.
Can anyone help me understand what might be causing this behavior? Also, what would be the correct way to make all these incidents inactive now?
Thank you for your help
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
My thoughts
-> you just set the state field in your fix script and not incident_state
-> there is this business rule "incident reopen" which marks the active field = true when you try to set the active=false
-> the BR condition is this
current.incident_state != IncidentState.CLOSED && current.incident_state != IncidentState.CANCELED
-> since you didn't update incident_state field the BR condition gets satisfied and it reverts active flag
-> Did you try to re-run the fix script to mark active=false and please use setWorkflow(false)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
a month ago
My thoughts
-> you just set the state field in your fix script and not incident_state
-> there is this business rule "incident reopen" which marks the active field = true when you try to set the active=false
-> the BR condition is this
current.incident_state != IncidentState.CLOSED && current.incident_state != IncidentState.CANCELED
-> since you didn't update incident_state field the BR condition gets satisfied and it reverts active flag
-> Did you try to re-run the fix script to mark active=false and please use setWorkflow(false)
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader