How to copy Impacted CI from Problem to Affected CI of Problem Task

Elena7
Tera Expert

Hello,

 

Wa recentely started to use a Problem module. I have a question: how to copy the Impacted CI's field from the Problem form to an Affected CI's field of the Problem Task' form. I also want to have a condition, if Impacted CI's field changes in the Problem, so the value in the Affected CI's field in Problem Task changes too.

 

The fields 'Impacted CI' and 'Affected CI' have different types. So I wanted to know what is the best way to do it?

 

 The Impacted CI's field on the Problem form:

Elena7_0-1693992494791.png

 

The affected CI's field on the Problem Task's form:

Elena7_1-1693992582985.png

 

Thank you in advance for your answers,

 

Elena

1 ACCEPTED SOLUTION

Hi @Elena7 Sorry for the confusion,  Can you Please revert back to the initial version of my Business Rule on "Problem task "table and on top of it Create a new Business rule on the "Problem" table as below:

 

EswarChappa_0-1694021575592.png

EswarChappa_1-1694021622326.png

 

(function executeRule(current, previous /*null when async*/ ) {
    var PT = new GlideRecord('problem_task');
    PT.addQuery('problem', current.sys_id);
    PT.query();
    while (PT.next()) {
        PT.cmdb_ci = current.cmdb_ci;
        PT.update();
    }
})(current, previous);

 

Thanks & Regards,

Eswar Chappa

Mark my answer correct and Helpful if this helps you 😀

View solution in original post

11 REPLIES 11

Hi @Elena7 Sorry for the confusion,  Can you Please revert back to the initial version of my Business Rule on "Problem task "table and on top of it Create a new Business rule on the "Problem" table as below:

 

EswarChappa_0-1694021575592.png

EswarChappa_1-1694021622326.png

 

(function executeRule(current, previous /*null when async*/ ) {
    var PT = new GlideRecord('problem_task');
    PT.addQuery('problem', current.sys_id);
    PT.query();
    while (PT.next()) {
        PT.cmdb_ci = current.cmdb_ci;
        PT.update();
    }
})(current, previous);

 

Thanks & Regards,

Eswar Chappa

Mark my answer correct and Helpful if this helps you 😀

Hello @Eswar Chappa ,

 

It works perfectly. Thank you very much!!!

 

Best regards,

Elena