- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 08:29 PM
Hi,
RITM is getting closed even if the mandatory fields are not filled this is happening with the workflow. But when i manually try to close the RITM i am getting the mandatory field to be filled alert.
REF::
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 10:26 PM
The issue is fixed. Added the if condition at the end of the workflow before closing the RITM. So it checks the variable if it is empty or not. If it is not empty it check until the variable is filled by using the wait condition once filled. It sets the RITM to closed completed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:12 PM
Hi,
You need to modify the workflow to check if the fields are filled in or not.
If it is the RITM fields, then data policy might help you. I see the mandatory fields here is the variables from the catalog items.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:21 PM
Hi,
Yes the field is from the variables. Can you help me out with the changes/script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 09:38 PM
Hi Hemanth,
I don't think workflow would respect the mandatory variables or fields since it runs on server side.
How is the RITM getting closed?
Also that variable you have shown is that not populated during catalog item submission?
Mark ✅ Correct if this solves your issue and also mark 👍 Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2019 10:05 PM
Hi Ankur,
The variable is a reference field to the change request table the variable change request field can be filled at any time after the catalog is submitted. The RITM is getting closed by the workflow. The below script does that once all the SCTASK are closed.
var cancelCount = 0;
var noncancelCount = 0;
var gr = new GlideRecord('sc_task');
gr.addQuery('parent',current.sys_id);
gr.query();
while(gr.next()){
if(gr.state == '11'){
cancelCount = cancelCount+1;
}else{
noncancelCount = noncancelCount + 1;
}
}
if(noncancelCount > 0){
current.state = '3';
var gr =new GlideRecord('sc_request');
gr.addQuery('sys_id',current.request);
gr.query();
if(gr.next()){
gr.request_state = 'closed_complete';
gr.update();
}
}else{
current.state = '14';
var gr =new GlideRecord('sc_request');
gr.addQuery('sys_id',current.request);
gr.query();
if(gr.next()){
gr.request_state = 'closed_cancelled';
gr.update();
}
}