- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2023 02:24 AM - edited 03-20-2023 09:35 PM
In order guide( new Hire) .
All the Requested item is closed complete--> but the Request_State is not changing to closed complete.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-20-2023 12:59 AM - edited 03-20-2023 01:02 AM
Hi @servicenow lath ,
As per my last post(How to close a RITM when the SC task is completed in Flow designer ), there's no need to write extra code,Instead, at the end of the workflow (at the End workflow activity), if we set the "stage" to "Completed" then we have OOB business rules, which would turn the RITM stage to "completed" and state to "close complete" .
You just need to set "stage' as 'Completed' at the end of your Flow /Workflow of RITM.
Please find below screenshots:
#Flow:
#Workflow:
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2023 02:52 AM
hi @servicenow lath ,
You can follow below steps in flow designer:
- Add a "Query Records" action to the flow and configure it to query for all Requested Items related to the specific Request.
- Add a "Check Condition" action to the flow and configure it to check if all of the Requested Items in the result set have a State of Closed Complete.
- If all of the Requested Items are Closed Complete, add an "Update Record" action to the flow and configure it to update the Request record's Request_State to Closed Complete.
- Save and activate the flow.
If my response helps you to resolve the issue close the question by ✅Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-17-2023 05:53 AM
Hi @servicenow lath ,
Please try with below Business Rule Script:
Create new BR on sc_req_item table , like below:
(function executeRule(current, previous /*null when async*/) {
var reqItemGr =new GlideRecord('sc_req_item');
reqItemGr.addEncodedQuery("state!=3^request="+reqItemGr.request); //check for all other RITM status
reqItemGr.query();
if(reqItemGr.getRowCount()==0){ //If all RITM closed
var reqGr =new GlideRecord('sc_request');
reqGr.get(reqItemGr.request);
if(reqGr.request_state!="closed_complete"){
reqGr.setValue('request_state',"closed_complete"); //update Req to close
reqGr.update();
}
}
})(current, previous);
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-18-2023 02:11 AM
Hi @servicenow lath ,
Alternatively you can Add an update action with Flow Designer and set the RITM stage to Completed. This will trigger business rules to close the RITM and the Request.
Please refer below KB articles:
How to close a RITM when the SC task is completed in Flow designer
Request is not closing when all RITM & SCTASK tickets under it are closed
If my response helps you to resolve the issue close the question by ✅Accepting solution and hit 👍thumb icon. From Correct answers others will get benefited in future.
Thanks,
Ratnakar
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-19-2023 08:14 AM - edited 03-19-2023 08:22 AM
@Ratnakar7 As Per Your suggestions i have created a Flow designer and BUsinees rule.
But in the Sc_request Record the Request_state value is not changing to closed_complete.
how to solve this issue??