The CreatorCon Call for Content is officially open! Get started here.

How do i auto-populate the field values from cmdb_ci_service table to cmdb_ci_outage table?

Mark263
Kilo Contributor

Hello all,

I have a field 'Recipients' on cmdb_ci_service table

type : list - referred to user table

my requirement is to dot-walk the field on the Outage table(cmdb_ci_outage). I was able to dot-walk the field just fine but it's not fetching the values from 'Recipients'(cmdb_ci_service).

How can this be achieved? Do i have to write a business rule for this? If yes,plz help me with the code.

1 ACCEPTED SOLUTION

OK, I made a mistake... it happens at 6AM. 🙂

Remove the condition and use this in the script instead. Same assumptions apply.

 

// If cmdb_ci has a value (not null)
if (current.cmdb_ci) {
   // Get the cmdb_ci record
   var ci = current.cmdb_ci.getRefRecord();
   // if the cmdb_ci record is a service
   if (ci.getTableName == 'cmdb_ci_service') {
     // Copy the recipients from the service record to the outage record
     current.u_recipients = current.cmdb_ci.u_recipients;
   }
}

View solution in original post

8 REPLIES 8

OK, I made a mistake... it happens at 6AM. 🙂

Remove the condition and use this in the script instead. Same assumptions apply.

 

// If cmdb_ci has a value (not null)
if (current.cmdb_ci) {
   // Get the cmdb_ci record
   var ci = current.cmdb_ci.getRefRecord();
   // if the cmdb_ci record is a service
   if (ci.getTableName == 'cmdb_ci_service') {
     // Copy the recipients from the service record to the outage record
     current.u_recipients = current.cmdb_ci.u_recipients;
   }
}

Hi

thank you for writing back

I did the changes but unfortunately, its not populating the values

i could see that the Business rule is executed but it's not giving the output.

find_real_file.png

 

Kindly help

I recommend using the Script Debugger to set a breakpoint and see what's happening. You can analyze the variables, values, and logic as it runs.

Hi Chuck Tomasi,

It's working now.

Thank you for your help.

The only correction i had to make is to add '()' to

ci.getTableName

Script Debugger helped a lot.. Thanks.