When Change Request closes then only problem ticket should close

Atik
Tera Contributor

Hi All,

I am working on problem management,

I have a requirement,

Out of the Problem ticket, we need to create a change request, only a Change Request closes, the problem record should close.

 

Can anyone help me with this?

 

Thanks,

Atik

1 ACCEPTED SOLUTION

Eswar Chappa
Mega Sage
Mega Sage

Hi @Atik I think You are not linking the relationship between the Problem and Change in your UI action, Can you Please check and Update the Parent value of the Change request to Problem.It works.

 

Cheers, hope that helps  /Eswar

*** Please mark as "Correct" or "Helpful" as appropriate ***

 

View solution in original post

5 REPLIES 5

Chetan Mahajan
Kilo Sage
Kilo Sage

Hello @Atik ,

                        Assuming you need to close Problem automatically, when associated change get closed. so you can use below script.

// Business Rule: Close associated problem when change request is closed
// Table: Change Request [change_request]
// Condition : State changes to Closed
// When: After update

            var problemGR = new GlideRecord('problem');
            if (problemGR.get(current.sys_id) {
                problem.state = 3; // Set problem state to "Closed"
                 // update other fields here if you want 
                problem.update();
            }

Kindly mark correct and helpful if applicable

Hi @Chetan Mahajan ,

Actually, the requirement is slightly different,

1. On the problem form when the change request is initiated(normal/standard/emergency) by right-clicking on the problem forms banner, the New Change Request record should be shown in a related list.

2. And State of the problem form should not transit to the Root cause Analysis to Fix in progress if Change is not implemented.

 

Could you please help me with this?

Thanks,

Atik

@Atik ,

  Create Before update BR on Problem Table

  Condition : state changes to "Fix in progress"

   // Check if the problem state is in  "Root Cause Analysis"  // you can skip this If condition as well
    if (current.state == 3 /* State code for "Root Cause Analysis" */) {

        // Get the associated Change Request record
        var changeRequest = new GlideRecord('change_request');
        if(changeRequest.get(current.change_request)){

        // Check if the associated Change Request is implemented
        if (changeRequest.state == '-1') {  // change value as per change-> implement 
            // Allow the problem state to be changed
            return;
        } else {
            // Prevent the problem state from being changed
            current.setAbortAction(true);
            gs.addErrorMessage("Problem could not be changed to 'Fix in progress' until the related change has been implemented.");
        }
    }
}

Kindly mark correct and helpful if applicable

 

It is not working. Throwing below error.

User712413_0-1722964976572.png