install_status in cmdb_ci table picks default status "installed"

Chinmayee1
Giga Contributor

Hi All, 

I am getting the cmdb CI records from an external source to cmdb_ci_appl table through a staging table. I am getting correct values for install_status in staging table in a string field. When I transform it to cmdb_ci_appl from staging , by default all the install_status are updated as "installed". Can someone advise me on how to get the correct install status to cmdb_ci_appl table ?

 

Thanks & Regards,

Chinmayee Mishra

12 REPLIES 12

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

Are the choice values same?

incoming value and the target choice values?

What is the choice action for that field map?

please check any before insert/update BR is setting it to installed

Also share screenshot of field map

Regards
Ankur

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Hi Ankur ,

No ,CMDB Application values are numeric 1 for Installed and 7 for Retired. My staging table has values in string as in "Installed" and "Retired" . I have written a transform script on that field map 

 

answer = (function transformEntry(source) {
var result;
gs.log("install status received :"+source.u_appl_install_status);
if(source.u_appl_install_status == "Installed"){result=1;}
else if(source.u_appl_install_status == "Retired"){result=7;}
gs.log("result Status :"+result);
return result;// return the value to be put into the target field

})(source);

 

however its still updating "Installed" for all the CI records. I printed the logs for the above.

 

result Status :1

result Status :7

result Status :1

result Status :7

 

and

install status received :Installed

install status received :Retired

install status received :Installed

install status received :Retired

In the table all the CI status are Installed. Please advise.

I believe the field is not get transformed as it seems like when we go to create a manual CI it will set the status as installed.

if(source.u_appl_install_status == "Installed"){result="1";}
else if(source.u_appl_install_status == "Retired"){result="7";}
gs.log("result Status :"+result);
return result;// return the value to be put into the target field

})(source);

Try with double quotes once & check.

Thanks

Sudhanshu 

Tried but no luck