Prevent users from moving the Change to the next State before the CSTASK is completed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-17-2019 01:55 AM
I have a Workflow for a Standard Change in which I would like to prevent the users from moving the Standard Change to the next State (this is done manually by clicking on the button or setting the 'State' filed to the desired state) before the CTASK created on this state (creation via Workflow) is set to one of the 'Complete' statuses.
In situation when the user clicks on the button of the next State and the CSTASK is still open, a message should be displayed indicating that the State cannot be changed because the task(s) have not been completed.
How can I best achieve this? I have read many posts and some people advise UI Actions, others Business Rules but due to my limited knowledge of scripting I cannot figure it out myself..
I appreciate your help!
Alicja
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 07:02 AM
Looks like it needs another } between the bottom two. If you hover over the red error markers it will tell you what is wrong, it highlights which curly braces correspond with each other so you can see which are unmatched.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 07:25 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 07:36 AM
replace current with g_form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 07:10 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-21-2019 07:38 AM
You've pasted the script outside of the class syntax:
var ChangeTaskUtils = Class.create();
ChangeTaskUtils.prototype = Object.extendsObject(AbstractAjaxProcessor, {
checkTasks: function(){
var changeID = this.getParamter('sysparm_change');
var gr = new GlideRecord('change_task');
gr.addQuery('change_request', changeID);
gr.addActiveQuery();
gr.setLimit(1);
gr.query();
return gr.hasNext();
},
type: 'ChangeTaskUtils'
});