Autopopulate Configuration Item from short description

Kamil24
Tera Contributor
Hi all, 
 
I'm trying to change an existing business rule to populate Configuration Item that match the one from short_description in the incident table, then it should change the location based on CI location. 
 
(function executeRule(current, previous /*null when async*/) {
 
if(!current.cmdb_ci) {
 
var grLocation = new GlideRecord('cmdb_ci_server');
grLocation.get(gs.getProperty('cmdb.ci'));
 
current.setValue('cmdb_ci', gs.getProperty('cmdb.ci'));
 
current.setValue('location', grLocation.getValue('location'));
}
 
Anyone have a suggestion here?
 
Much appreciated
1 REPLY 1

Saurav11
Kilo Patron
Kilo Patron

Hello,

 

Change the script to before insert/update.

 

and i hope the property name is correct and correct values ahs been stored:-

 

gs.getProperty('cmdb.ci')

 

Please mark my answer as correct based on Impact.