- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 09:33 AM
Hi everyone, as a OOTB we can add change request to incident under related records section. My request is how to restrict incident resolve if any open CR is there on change request field. CR should be at least on review state to resolve the incident.
I'm trying with below script but it's not working. Precisely it's working but abort action is working every time. So irrespective of CR state , transaction is aborting..
Pls help me here
var gr = new GlideRecord("change_request");
gr.addEncodedQuery('number', current.rfc + "state=-5");
gr.query();
if (gr.next()) {
gs.addErrorMessage("Please close the CR and proceed..");
current.setAbortAction(true);
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:28 AM
Hi @Vijaykumar K ,
Hope you are doing well.
No need to write a script please refer below screenshot -
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 09:50 AM
Hello Vijaykumar K,
current.rfc will give you sys_id of CHG record so your encodedQuery should be something like gr.addEncodedQuery("sys_id="+current.rfc+"stateIN0,3");
First, try to filter the CHG record form LIST of the CHG table and copy the encoded query, and try to build as per your requirement.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:15 AM
Rampriya S
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:28 AM
Hi @Vijaykumar K ,
Hope you are doing well.
No need to write a script please refer below screenshot -
Please mark this response as correct or helpful if it assisted you with your question.
Regards,
Harshal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2023 10:09 PM
Hello @Harshal Aditya .. thats what I'm looking for. Thanks a lot 🙂