How to create multiple selection checkbox in Record producer?

alvatindra
Giga Contributor

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:

find_real_file.png

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

8 REPLIES 8

shing
Kilo Contributor

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?


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


123.PNG


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.


Srikanth Menava
Kilo Sage

If a user want to select multiple options , create 4 different check- boxes as shown in the below attached picture


123.PNG


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.


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?