Notifications

133 views

Description

With the Enforce Change Request process data requirements based on property: com.snc.change_management.enforce_data_requirements, updates to in-progress Change Requests are prevented. However there is a scenario i.e. save button where the Configuration Item is added to Change Request form and the state is set to the next available state (not new). Since the change request is now in-progress but the task_ci table has not yet been populated, the business rule that should populate task_ci fails. An initial solutions was to setWorkflow(false) in the BR that was inserting into the task_ci table so that it bypasses the "Enforce Change Request process". This however prevents any on INSERT Business Rules from running on task_ci for the scenario described.

This fix and work around resolves both issues.

 

Steps to Reproduce

  1. Create an INSERT Business Rule on table: task_ci
  2. Navigate normal change change request.
  3. Provide CI item as Email and Assignment Group to Database.
  4. Change the state to Assess.
  5. Save the record from context menu.

Expected: the BR created in step #1 should run.
Actual: The BR created in step #1 does not run.

Workaround

sys_script_79d9cf820a0a2c3e1bc20f964f0b8866.xml BR: Add CI in affected Cis List

FROM:

perform();
function perform(){
    if(!ChangeCollisionHelper.isCiInAffectedCis(current.cmdb_ci,current.sys_id)){
        ChangeCollisionHelper.addCiToChangeAffectedCis(current.cmdb_ci,current.sys_id);
    }
}

TO:

if (!ChangeCollisionHelper.isCiInAffectedCis(current.cmdb_ci, current.sys_id)) {
    GlideController.putGlobal('CHANGE_REQUEST_FROM_NEW', (current.operation() === "insert"));
    ChangeCollisionHelper.addCiToChangeAffectedCis(current.cmdb_ci, current.sys_id);
}

sys_script_include_63853c880a0a2c3e15136f8080b90e5e.xml Script Include: ChangeCollisionHelper

FROM:

ChangeCollisionHelper.addCiToChangeAffectedCis = function(ci, changeId) {
    var affectedCiGR = new GlideRecord('task_ci');
    affectedCiGR.task = changeId;
    affectedCiGR.ci_item = ci;
    affectedCiGR.setWorkflow(false);
    affectedCiGR.insert();
};

TO:

ChangeCollisionHelper.addCiToChangeAffectedCis = function(ci, changeId) {
    var affectedCiGR = new GlideRecord('task_ci');
    affectedCiGR.task = changeId;
    affectedCiGR.ci_item = ci;
    affectedCiGR.insert();
};

sys_script_9f427066b7ab23000999e4f6ee11a9ae.xml BR: Read only Affected CI when not New

FROM:

if (!new ChangeRequest(current.task.getRefRecord()).isNew()) {
    if (current.operation() === "delete" && !current.ci_item.nil()) {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be removed for in-progress Change Requests. CI: {0} left unchanged", [current.ci_item]));
        current.setAbortAction(true);
    } else if (current.operation() === "insert") {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be created for in-progress Change Requests. CI: {0} not associated", [current.ci_item]));
        current.setAbortAction(true);
    } else if (current.operation() === "update" && current.ci_item.changes()) {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be changed for in-progress Change Requests. CI: {0} left unchanged", [current.ci_item]));
        current.setAbortAction(true);
    }
}

TO:

abortIfInvalid(current);
function abortIfInvalid(taskCiGr) {
    // valid if Change Request is new or is being saved in next valid state (effectively from new state)
    if (new ChangeRequest(taskCiGr.task.getRefRecord()).isNew() || ("" + GlideController.getGlobal('CHANGE_REQUEST_FROM_NEW')) === "true")
        return;
    if (taskCiGr.operation() === "delete" && !taskCiGr.ci_item.nil()) {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be removed for in-progress Change Requests. CI: {0} left unchanged", [taskCiGr.ci_item.getDisplayValue()]));
        taskCiGr.setAbortAction(true);
    } else if (taskCiGr.operation() === "insert") {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be created for in-progress Change Requests. CI: {0} not associated", [taskCiGr.ci_item.getDisplayValue()]));
        taskCiGr.setAbortAction(true);
    } else if (taskCiGr.operation() === "update" && taskCiGr.ci_item.changes()) {
        gs.addInfoMessage(gs.getMessage("Affected CIs cannot be changed for in-progress Change Requests. CI: {0} left unchanged", [taskCiGr.ci_item.getDisplayValue()]));
        taskCiGr.setAbortAction(true);
    }
}

 

 


Related Problem: PRB1365088

Seen In

SR - IRM - Audit Management - New York 2019 Q3
SR - IRM - GRC Profiles - Madrid 2019 Q2
SR - IRM - GRC Workbench - New York 2019 Q3
SR - IRM - PA Premium Integration - New York 2019 Q3
SR - IRM - Policy and Compliance - Madrid 2019 Q2
SR - IRM - Risk Management - New York 2019 Q3
SR - IRM - SIG Assessment Legacy - Madrid 2019 Q1
SR - IRM - Vendor Risk Management - Madrid 2019 Q1
SR - ITOM - Discovery and Service Mapping - v1.0.35
SR - Security - Integration Framework - Madrid 2019 Q2
SR - Security - Support Common - Madrid 2019 Q2
SR - Security - Support Orchestration - Madrid 2019 Q2
SR - SIR - Store SecOps Setup Assistant - Madrid 2019 Q2
SR - VR - Rapid7 - London 2019 Q2 v.6.2.1
SR - VR - Vulnerability Response - New York 2019 Q3
SR - VR - Vulnerability Response PA Content - Madrid 2019 Q2

Fixed In

New York Patch 7
Orlando

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2020-03-27 11:51:18
Published:2020-03-04