- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2020 02:56 PM
When the state field changes in RITM then, REQ state needs to be changed.
RITM States: REQ States :
Open Pending Approval.
Closed Complete. Approved, Closed Complete
Closed Incomplete Closed Incomplete, Closed Cancelled, Closed Rejected
Closed Skipped Closed Skipped
For Approval the state changes works fine, But not for the rejection alone.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2020 03:06 PM
Is Request and Requested Item always a one-to-one? If not, I think there is a better solution.
If it is a one-to-one your script works with a few tweaks:
Create an After Update Business rule on the Requested Item with following code:
(function executeRule(current, previous /*null when async*/) {
var request = new GlideRecord('sc_request');
request.get(current.request)
if (current.state == '3') {
request.active = false; // set active to false
request.request_state = '3'; // Set state to closed Complete
request.update();
}
else if (current.state == '4') {
request.active = false; // set active to false
request.request_state = '4'; // Set state to closed Incomplete
request.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2020 03:06 PM
Is Request and Requested Item always a one-to-one? If not, I think there is a better solution.
If it is a one-to-one your script works with a few tweaks:
Create an After Update Business rule on the Requested Item with following code:
(function executeRule(current, previous /*null when async*/) {
var request = new GlideRecord('sc_request');
request.get(current.request)
if (current.state == '3') {
request.active = false; // set active to false
request.request_state = '3'; // Set state to closed Complete
request.update();
}
else if (current.state == '4') {
request.active = false; // set active to false
request.request_state = '4'; // Set state to closed Incomplete
request.update();
}
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2020 03:10 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2020 03:18 PM
Hi Laskshmi,
I think this is not a write approach to make the changes, because every Request may have multiple RITM's its very difficult to manage.
I would suggest instead of BR, you may have the workflow on RITM right, in the workflow itself you can simple use the Set Values activity just closed successful or close incomplete.
Or
Another simple way is to try with Flow Designer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-23-2020 08:21 AM
Trying in Flow, Need help with Rejection.
Approval works fine.