How to create multiple selection checkbox in Record producer?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-19-2016 05:28 AM
I have a requirement to create a multiple selection checkbox field, where I can select multiple options.
I have to store the values of the options in the corresponding table when record producer is submitted.
Ex:
I want to store the checkbox values in the corresponding field of the table(incident) when record producer is submitted.
There is no option to create the checkbox in the table, I have created the list field and tried to map the options from the record producer but its not working.
How this functionality can be achieved.
Please Share your knowledge regarding this.
--Tindra
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-22-2017 01:04 PM
Hi! I am new to ServiceNow and need to create a multiple choice list where users must choose at least one or more choice, and it must be mandatory on a record producer. I am on Helsinki.
For requestable items, I can use UI policy to do this, but scripting seems to be the only choice for record producer. I have used the codes above but it did not work, can I get some help on this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 10:30 AM
Hey Sheng,
You can crete a new variable with "Selct Box " field and configure choices and make it mandatory. but this allows to select only one option,
If a user want to select multiple options , create 4 different check- boxes as shown in the below attached picture
and write a catalog client script
on-submit condition
function onSubmit() {
var fields = ['c1','c2','c3','c4'];
function requireOne(fields, message) {
var i;
for (i = 0; i < fields.length; i++) {
if (g_form.getValue(fields[i]) == 'true') {
return true;
}
}
alert(message);
return false;
}
return requireOne(fields, 'Please select at least one variable');// this alert message can be changed as you want.
}
I hope this helps
Please mark helpful/ Answered depending on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-23-2017 10:37 AM
If a user want to select multiple options , create 4 different check- boxes as shown in the below attached picture
and write a catalog client script
on-submit condition
function onSubmit() {
var fields = ['c1','c2','c3','c4'];
function requireOne(fields, message) {
var i;
for (i = 0; i < fields.length; i++) {
if (g_form.getValue(fields[i]) == 'true') {
return true;
}
}
alert(message);
return false;
}
return requireOne(fields, 'Please select at least one variable');// this alert message can be changed as you want.
}
if you want to populate the values in the corresponding table this can aslo be done.
create 'True/False' field and map it the corresponding fields on the record Producer.
so that You can populate the options when record producer is submitted.
I hope this helps
Please mark helpful/ Answered depending on the Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-25-2017 11:39 AM
Thank you, the codes worked! I was unaware that we are able to map the catalog client script with record producer.
Just something I'm wondering about, since it's better practice to use UI policy vs scripting, and since we can map over a catalog variable set (that has UI policy) into a record producer, is it better to create a variable set each time for a record producer or create a new script for it each time?