- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 01:48 PM
Hello Genius,
I have a small requirement, If RITM state is set to closed incomplete, the relevant request should get closed incomplete. Due to workflow it is not updating it properly. Can any one help me on this please.
Kindly note, when the RITM is set to Closed Incomplete, we have to set RITM stage as closed incomplete & RITM Approval as "Rejected" and REQ Request state as "Closed Incomplete" & REQ Approval as "Rejected". I have tried few ways but no luck.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 03:11 PM
Hi Arun,
I have tried below Business rule on after insert/update on sc_req_item and it's working, please try and see if it helps.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var req_item = new GlideRecord('sc_req_item');
req_item.get(current.sys_id);
if(req_item.state =='4')
{//Set your appropriate state here
req_item.stage ='Closed Incomplete';
req_item.approval = 'Rejected';
req_item.update();
var req = new GlideRecord('sc_request');
req.get(req_item.getValue('request'));
req.request_state = 'Closed Incomplete';
req.approval = 'Rejected';
req.update();
}
})(current, previous);
BR Configuration:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 09:31 PM
Hi Shishir,
You made my day. It's working great. Your help is highly appreciatable. Sorry i don't know how to make this as correct answer.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 09:35 PM
Hi Arun,
Thank you for your valuable feedback, please check How to Mark Answers Correct From Inbox View.
Hi dan.bruhn : Please help.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 10:43 PM
Done:)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2017 06:14 AM
Hi Shishir,
One more additional question, if we have more than one RITM for a single REQ, how we can control that.
For Ex:
I want to set REQ state to closed Incomplete only if all the RITM's set to closed incomplete. If 1 RITM is set to closed incomplete and the another one is set to closed complete then it should set REQ state as closed Complete. Kindly advise how we can achieve this.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2017 11:21 PM
Hi Arun,
This should help:
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var req_item = new GlideRecord('sc_req_item');
req_item.addQuery('request', current.request);
req_item.addQuery('state', '3');
req_item.query();
if(req.next())
{
var req = new GlideRecord('sc_request');
req.get(req_item.getValue('request'));
req.request_state = '3';
req.update();
}
})(current, previous);