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

How to set the value in Configuration Item field using the data from the Question Choices

Jake Paz
Kilo Explorer

Hi Everyone,

How do I set the value of the Configuration Item field using the data from the selection in the Question Choices?

I have selected the "WIRELESS" in the question choices and I have set the variable to map it to the Configuration item but still not working. 

Can an onChange script archive this requirement as well? Please help.  Thank you!

 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Please use this below code snippet:

var congItem = producer.getValue('variable name');
var gr = new GlideRecord('cmdb_ci');
gr.addQuery('name',congItem);
gr.query();

if(gr.next()){
current.cmdb_ci = gr.getUniqueValue();
}

 

Remove Map to field option for your variable as your populating CI with the script.

Mark it as Correct if it fulfills your requirement

 

Thanks

Vamshidhar

View solution in original post

8 REPLIES 8

Vamshi dhar
Kilo Guru

Hi Jake,

As it's a reference field in your Change Table, you have to return sys_id then only it will work. 

You can make use of a Record producer script to achieve this requirement.

First, you have to get the value that you have entered in "Please select device A" in Record Producer then you have to glide the table and you have to set the value in Change Table by making use of sys_id.

 

This works in this way

Please let me know if you have any other questions

 

Thanks

Vamshidhar

Jake Paz
Kilo Explorer

Hi Vamshi,

Thanks for your reply. Do you have a sample script on how to achieve this? Thanks!

on the record producer script you can try 

current.cmdb_ci=producer.Configuration_item;

find_real_file.png

producer.Configuration_item------>(variable name)

Please use this below code snippet:

var congItem = producer.getValue('variable name');
var gr = new GlideRecord('cmdb_ci');
gr.addQuery('name',congItem);
gr.query();

if(gr.next()){
current.cmdb_ci = gr.getUniqueValue();
}

 

Remove Map to field option for your variable as your populating CI with the script.

Mark it as Correct if it fulfills your requirement

 

Thanks

Vamshidhar