Map a catalog item:s reference variable to sc_req_item:s "configuration_item" field in Back-end.

ronro2
Tera Contributor

Hello guys!

I'm trying to map a reference variable called 'pr_number' (based on alm_asset) to a sc_req_item field called 'configuration_item' in Back-end. 

I have a workflow connected to my catalog item with this reference variable called pr_number. 

 

This is the script I use: 

else if (current.variables.pr_number) { current.configuration_item = current.variables.pr_number.cmdb_ci; // Map pr_number to configuration_item }

 

The problem is that it is always empty. Is there anything I've missed? It should be possible to dot-walk right? 

1 ACCEPTED SOLUTION

Brad Bowman
Kilo Patron
Kilo Patron

The field on the alm_asset table labeled Configuration Item for some reason is named 'ci', so this part of your script would be

 

else if (current.variables.pr_number) { current.configuration_item = current.variables.pr_number.ci; // Map pr_number to configuration_item }

 

Also, for some reason there are two fields labeled 'Configuration item' on the sc_req_item table, one named 'cmdb_ci' and the other named 'configuration_item' so ensure you are setting the correct one in your script for your environment based on the field that is shown on the form...

View solution in original post

2 REPLIES 2

Brad Bowman
Kilo Patron
Kilo Patron

The field on the alm_asset table labeled Configuration Item for some reason is named 'ci', so this part of your script would be

 

else if (current.variables.pr_number) { current.configuration_item = current.variables.pr_number.ci; // Map pr_number to configuration_item }

 

Also, for some reason there are two fields labeled 'Configuration item' on the sc_req_item table, one named 'cmdb_ci' and the other named 'configuration_item' so ensure you are setting the correct one in your script for your environment based on the field that is shown on the form...

You are amazing!