Making Risk Assessment Mandatory Using the below Business Rule is not Working
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-28-2024 11:24 PM
Hi All,
Current requirement is to make Change Risk Assessment mandatory before submitting for approval in New State. I tried the below business rule which was posted in community earlier and it is not working. Kindly suggest.
When to Run: Before update
Condition: current.state.changesTo(-4)
(function executeRule(current, previous /*null when async*/) {
var assessmentinstance = new GlideRecord ('asmt_assessment_instance');
assessmentinstance.addQuery('task_id', current.sys_id);
assessmentinstance.query();
if(!assessmentinstance.next())
{
current.setAbortAction(true);
gs.addInfoMessage('Please perform risk assesment before requesting for approval');
current.state = -5; //check state value
current.approval = 'not requested'; //remove it if you don't want to set approval
}
})(current, previous);
0 REPLIES 0