How to copy the Child task(s) companies to Parent record companies LIST ,Need clarity BR when to RUN

yesubabu Jonnal
Tera Contributor

We have a Parent Problem Under we have Child Incidents 

Let's suppose The parent Problem company is "A" 

1. We have added a child incident with company "A". 

2. We added another incident with company "B".

3. And also added one more incident with the company "C"

 

We have copied company values from 1, 2 & 3 incidents and added this list to the Parent problem record

1 is A = Not required to add in LIST This is equal to the parent company 

2 is B && 3 is C needs to be added to the Parent problem record 

 

Fields in Problem

1."Is this impacted to other companies: = Yes ;

2." Add the impacted list ":[] type is LIST 

 

How can we achieve this and when to run BR in this case when child added.

(function executeRule(current, previous /*null when async*/ ) {
    var arr = [];
var problemId = current.problem_id;
var incidentcompany = current.u_company;
    var yep = new GlideRecord('problem');
    yep.addQuery('sys_id', problemId);
    yep.query();
    while (yep.next()) {
        var problemBottler = yep.u_company;
    }
    for (var k = 0; k < arr.length; k++) {
        gs.addInfoMessage(arr[k]);
    }
    if (arr.length >= 1) {
        current.Is this impacted to other companies = 'yes';
        for (i = 0; i < arr.length; i++) {
            current.Add the impacted list = arr[i];
        }
    }
3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @yesubabu Jonnal 

 

Are you using domain seperation?

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

yesubabu Jonnal
Tera Contributor

Hi @Dr Atul G- LNG , We are in  MSP domain separated instance

Hi @yesubabu Jonnal 

 

Few things need to take care

 

If a problem is for many companies, then better to create in Global domain.

If no then company B and C must have visibility /contains  access enabled. 

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************