Skip to content

Commit 63dc0d4

Browse files
authored
Change Request risk Assesment mandatory when moving from new state (#1475)
* Create readme.md Description of the BR * Create script.js Script
1 parent 094a94b commit 63dc0d4

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This is a code snippet which can be used in a Business rule to prevent the state of Change Request Move from New state when there is no risk Assesment attached to the Change Request.
2+
Table : change_request When: Before Update: True Conditions : state || CHANGESFROM || New AND state || is not || Cancelled AND type || is one of || Normal,Emergency
3+
Note: This script is helpful for all the tables and their related tables which has assesmenets enabled, The BR should be created on related table and filters can be added accordingly
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function executeRule(current, previous /*null when async*/ ) {
2+
3+
// Assesments once submitted are stored in Assesment Instances Table with record value mapped.
4+
var assessmentinstance = new GlideRecord('asmt_assessment_instance');
5+
assessmentinstance.addQuery('task_id', current.sys_id); //
6+
assessmentinstance.setLimit(1);
7+
assessmentinstance.query();// Query the record
8+
if (!assessmentinstance.hasNext()) //If there are no assesments
9+
{
10+
gs.addInfoMessage('Please perform risk assesment before requesting for approval');
11+
current.setAbortAction(true);
12+
action.setRedirectURL(current);
13+
}
14+
})(current, previous);

0 commit comments

Comments
 (0)