- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 12:22 AM
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!
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:43 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 12:49 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 12:55 AM
Hi Vamshi,
Thanks for your reply. Do you have a sample script on how to achieve this? Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:40 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-23-2020 01:43 AM
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