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,18 @@
This Before Update business rule acts as a safeguard in a Change management process,
ensuring that critical changes(those marked as high impact or high risk)
are properly documented before progressing to key implementation stages.

**BR Type**: 'Before', 'Update'
**Table**: Change Request (change_request)
**Condition**: 'State' 'changes to' 'Scheduled' OR 'State' 'changes to' 'Implement'

**What It Does**:
-The BR triggers before a change request record is updated, specifically when the state changes to either Scheduled or Implement.

-It checks whether the change is classified as high impact or high risk.

-If the change meets either of those criteria, it verifies that at least two attachments are present on the record.
These attachments are expected to be essential supporting documents like an Implementation Plan or Backout Procedure.

-If the required documentation is missing, the rule blocks the state change and displays an error message to the user,
preventing the change from moving forward until compliance is met.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
(function executeRule(current, previous /*null when async*/ ) {

var minAttachments = 2;

var isHighImpact = current.impact == '1';
var isHighRisk = current.risk == '2';

if (isHighImpact || isHighRisk) {

var attachmentCount = 0;
var attachment = new GlideAggregate('sys_attachment');
attachment.addQuery('table_sys_id', current.sys_id);
attachment.addAggregate('COUNT');
attachment.query();
if (attachment.next()) {
attachmentCount = attachment.getAggregate('COUNT');
}

if (attachmentCount < minAttachments) {

gs.addErrorMessage('State Change aborted: High-Impact/High-Risk Changes require at least ' + minAttachments + ' supporting documents (eg: Implementation Plan, Backout Procedure)' + 'attached before moving to the Scheduled/Implementation phase.');
current.setAbortAction(true);
}
}

})(current, previous);
Loading