How to auto populate CI location when a CI is populated through inbound email action

Sandeep109
Mega Contributor

Hi All,

 

The requirement is to auto populate CI location when a CI is populated through inbound email action

i am able to populate the CI name in the field 'configuration item' but how to populate the CI's location in the location field when CI is populating is my question (we have location mapped to each CI item so that needs to populate in the 'location' field)

Should we write an Onchange or Onload client script?

I am thinking of Onchange client script, then selecting table  as incident table and selecting the filed as 'Configuration Item' and script is like

if('newValue!=oldValue') {

current.location=cmdb_ci.location; //is this correct way 

}

or if there is an another way please advice

 

Thanks and Regards,

Sandeep

2 REPLIES 2

Akshay37
Mega Guru

Hi Sandeep,

 

you need to handle this through BR or inbound action only. Client script will not work in this scenario as CI is auto populating through inbound action, you are not creating it manually.

 

Try writing BR on incident table using condition ,

configuration item is not empty and configuration item changes.

Then populate location

 

Please Mark it correct or helpful if this helps you.

 

Thanks,

Akshay

 

 

Hi Akshay,

Thanks for the advice

I will try to write the glide record script for in the business rule (advanced) for the incident table but please correct me in the script if am wrong

var inc=new GlideRecord('incident);

inc.addNullQuery('cmdb_ci');//trying to get the records with empty CI fields in the incident table

inc.query();

while(inc.next()){

inc.setValue('current.location=cmdb_ci.location'); //will this line fetch/auto populate the location of the CI?

}