Reset workflow for REQ and RITM and Approvals
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-08-2024 10:25 PM - edited 08-09-2024 07:19 AM
Hi all,
I have a below requirement.
When the state is “Closed Skipped” or “Closed Incomplete,” and the Parent REQ is closed, mark it as active, set the state to “Pending Approval,” in REQ restart the workflow, set the RITM state to 1, activate it, restart the associated flow, and add a work note indicating the request has been restarted by the 'current user'.
its a UI action i have written a code the states of REQ and RITM is changing and worknotes getting updated but the Approvals set to cancelled, in approvals i found the worknotes as RITM workflow restarted but the workflow didn't reset.
var req = new GlideRecord('sc_request');
req.addQuery('sys_id', current.request);
req.query();
if (req.next()) {
if (req.request_state == 'closed_incomplete' || req.request_state == 'closed_skipped') {
req.setWorkflow(false);
req.active = true;
req.request_state = 'requested';
req.update();
gs.info('Parent request state updated to Requested');
new Workflow().cancel(current);
new WorkflowApprovalUtils().cancelAll(current, "Workflow and approvals reset as part of request restart.");
current.active = true;
current.state = '1';
current.update();
new Workflow().restartWorkflow(current);
gs.info('Workflow restarted for RITM: ' + current.sys_id);
current.work_notes = 'Request has been restarted by ' + gs.getUserDisplayName();
current.update();
}
}
action.setRedirectURL(current);
REQ:
RITM:
worknotes and approvals
Approval:
REQ workflow :
we have flow designer for RITM
pls assist me to resolve this
@Ankur Bawiskar @Dr Atul G- LNG @Allen Andreas @Anurag Tripathi @Jaspal Singh @Community Alums
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2024 12:20 PM
Hi @shaik23
I have a below requirement.
When the state is “Closed Skipped” or “Closed Incomplete,” and the Parent REQ is closed, mark it as active,
Atul: When REQ is closed, and you want to mark is Active true, it is a pure violation of the process and foundation principles of ITIL. Highly NOT RECOMMENDED.
set the state to “Pending Approval,” in REQ restart the workflow, set the RITM state to 1, activate it, restart the associated flow, and add a work note indicating the request has been restarted by the 'current user'.
Atul: As above, RITM once close is closed, dont reopen or restart. You are increasing technical debt.
its a UI action i have written a code the states of REQ and RITM is changing and worknotes getting updated but the Approvals set to cancelled, in approvals i found the worknotes as RITM workflow restarted but the workflow didn't reset.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************