- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 12:04 PM
Hello,
I have created a new business rule in order to change the parent request state to close when all
related RITMs are closed or canceled.
Please let me know if the script is ok
closeRequest();
function closeRequest(){
var gr = new GlideRecord('sc_req_item');
gr.addQuery('request', current.request);
gr.addQuery('state', '!=', 3);
gr.query();
if (!gr.next()){
var sc_request = new GlideRecord('sc_request');
sc_request.addQuery('sys_id', current.request);
sc_request.query();
if (sc_request.next()){
sc_request.state = 3;
sc_request.update();
}
}
}
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-31-2018 01:30 PM
In workflow you can set the stage of an activity which then sets the stage attribute on the request item. All of the out of the box examples use the "Completed" stage either on the end activity or just before the end activity. Here is example from the procurement workflows:
here is example from Service Catalog Item Request workflow:
Now changing your workflows won't address your existing 5000 records so a Fix script will be necessary to fix those. But this will help with any new requests.
Please mark any post as helpful or the correct answer to your question if applicable so others viewing may benefit.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-05-2018 08:44 AM
Hi Michael,
Thanks for the suggestion.
I'm trying to figure out which table field to select when creating the new workflow?