- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2016 01:19 PM
I need a way to prevent the Request for Change from being closed until all Change Tasks (Ctasks) have been closed. The valid state(s) for change tasks being complete are (state =3 (closed complete), 4 (closed incomplete) or 7(closed skipped) otherwise a message should appear that open Tasks must be closed first before closing the RFC. I believe a business rule script is needed, but not familiar with writing scripts. I had tried the below script that I found on the community, but it is not working for me.
Currently when I close a RFC, all tasks are marked as closed complete automatically (same user and date/time stamp as the RFC closure) and cannot find why/ where this is happening.
Thanks in advance for any help!
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2016 02:16 PM
Instead of checking the state of change request in the script, put them in the filter conditions for the business rule, like state changes to Closed. Then in the script use this
var target= new GlideRecord("change_task");
target.addQuery("change_request",current.getValue("sys_id"));
target.addActiveQuery();
target.query();
if(target.hasNext()){
gs.addInfoMessage("your message");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2016 01:27 PM
have you looked at the Workflow?
are your tasks being created manually or by the Workflow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2016 01:47 PM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2016 02:16 PM
Instead of checking the state of change request in the script, put them in the filter conditions for the business rule, like state changes to Closed. Then in the script use this
var target= new GlideRecord("change_task");
target.addQuery("change_request",current.getValue("sys_id"));
target.addActiveQuery();
target.query();
if(target.hasNext()){
gs.addInfoMessage("your message");
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2016 07:25 AM
Works great - Thanks so much!!!