- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I'm working on a requirement where Normal Change Requests need to be automatically reverted from Assess to New if they miss the CAB submission deadline.
To achieve this, I created a scheduled job that runs every Saturday. It identifies eligible Normal Changes in the Assess state, updates the state back to New, adds a work note, sets a custom flag, and sends a notification to the Change Owner to update the dates and resubmit the Change.
The state update is simply:
chgGR.state = -5; // New
chgGR.setValue('u_reverted_to_new_by_system', 'true');
chgGR.work_notes = 'This change is Auto-reverted from Assess to NEW State';
chgGR.update();
Issue-
1.The first time a Normal Change is submitted, clicking Request Approval works as expected:
The Change moves to Assess.
The legacy Change Request - Normal workflow starts.
Approvers are generated successfully.
2.However, after the scheduled job reverts the Change back to New:
The user updates the planned dates.
Clicks Request Approval again.
The Change moves back to Assess, but no approvers are generated.
From my analysis, only the state is being updated by the scheduled job. The existing workflow context is not restarted or reset, so the approval generation step is not executed again.
What I tried
-I manually cancelled the existing workflow context and clicked Request Approval again.
-The Change moved to Assess, but no new workflow context was created and no approvers were generated.
-If I change the Change Type to Emergency, the Emergency Change workflow starts normally and approvals are generated.
Is there a supported way to restart or reinitialize the legacy "Change Request - Normal" workflow for an existing Change Request after it has been reverted from Assess to New?
Thanks in advance!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @snehalkausa
Refer: Reset a workflow Change Request - Normal in dev instance
https://servicenowguru.com/business-rules-scripting/reset-change-request-workflow-approvals-tasks/
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @snehalkausa
Refer: Reset a workflow Change Request - Normal in dev instance
https://servicenowguru.com/business-rules-scripting/reset-change-request-workflow-approvals-tasks/
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Tanushree Maiti
Thank you for your reply, I have got the fix for the Normal change request. Now when the scheduled job reverts the Change requests back to New, we can see the customer coordination task gets opened and upon completing it when I click on Request approval , the change moves to Assess state and it generates the approvers. So basically, it has cancelled the previous workflow context and restarted.
However during testing I identified another issue with Emergnecy Change-
If the user changes the Change Type from Normal to Emergency after the Change has been reverted to New, the following occurs:
Assess
↓
Scheduled Job
↓
State = New
u_reverted_to_new_by_system = true (hidden field)
↓
Workflow is restarted
↓
Customer Coordination Task is reopened
↓
User changes Type = Emergency
↓
Emergency workflow starts
↓
Emergency Customer Coordination Task and EC Review Task are created
As a result, there are two Customer Coordination Tasks associated with the Change:
One reopened from the Normal Change workflow.
One newly created by the Emergency Change workflow.
Is there a way, we can cancel the Customer Coordination Task associated to Normal change when it is Emergency change?