Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

dynamic creation of checkbox

SnowDEV2
Kilo Expert

Hi,

I want some value to be fetched from a table & display them as check-box in a catalog item.

Thanks in advance

27 REPLIES 27

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hi Latesh,



There are other way to display the value from reference tables i.e by creating a field of type "reference field" or "list collector".


If you still want to go ahead with creation of checkbox then the sample script would be something like this.


var gr = new GlideRecord('item_option_new');


gr.initialize();


gr.cat_item = '039c516237b1300054b6a3549dbe5dfc'; //sys_id of the cat item


gr.type = '7'; // 7 is the value for the field of type checkbox


gr.question_text = 'test';


gr.name = 'test';


gr.insert();



Thanks for your reply Pradeep!.


Basically I need to retrieve   some values from the custom table based on the requester value and display them as a check box value dynamically.


These check box values and count   should change based on the values retrieved from the   custom table for every requester.


Hi pradeep,



I have some problem in creating check-box in UI page. Check this link: Custom UI Page


Can I directly create check-box on UI page using script you mentioned above. (Because unable to create check-box using HTML).



Any help would be appreciated.


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Also check this app from share


ServiceNow Share