Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
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.
Table : change_request When: Before Update: True Conditions : state || CHANGESFROM || New AND state || is not || Cancelled AND type || is one of || Normal,Emergency
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
(function executeRule(current, previous /*null when async*/ ) {

// Assesments once submitted are stored in Assesment Instances Table with record value mapped.
var assessmentinstance = new GlideRecord('asmt_assessment_instance');
assessmentinstance.addQuery('task_id', current.sys_id); //
assessmentinstance.setLimit(1);
assessmentinstance.query();// Query the record
if (!assessmentinstance.hasNext()) //If there are no assesments
{
gs.addInfoMessage('Please perform risk assesment before requesting for approval');
current.setAbortAction(true);
action.setRedirectURL(current);
}
})(current, previous);
Loading