Dynamically create checkbox using catalog client script

appportal
Kilo Contributor

Hi,

My requirement is to dynamically create checkbox using catalog client script in the "On Change" event of a select box.

I have a variable set (which applies to some service catalogs), in which there is a select box, which is populated using a REST API. When the selected value in the select box changes, a catalog client script should be triggered, and check box (multiple check boxes) should be created. The text of these check boxes will be populated from the response of a REST API.

Is this possible? I have checked the wiki and couldn't find a way to do this. I have tried for other variable types as well (like List Collector) but I couldn't find anything that can help.

Help is much appreciated.

Thanks,

Satheesh.

7 REPLIES 7

Chris M3
Tera Guru

You can't dynamically create new variables.   Your best bet would be a UI Page variable, where you could dynamically create new checkboxes in the UI Page.   I don't have an example for you, but I would have a hidden checkbox in the UI Page that I copy for each value in the response, set the label and display.   The hidden one in the page acts as a template.


Hi Chris,



The main concern/issue here would be if we use the UI Page and checkboxes will be created dynamically, but what if user selects 2 checkboxes and submits the request. The same 2 checkboxes should be shown as checked when user opens the RITM after submission.



Regards


Ankur


Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur, 

 

I have a similar requirement where I need a dynamic valu in middle of check box Statment.. 

Ex:- There will be a task included in this request that requires the <Support Group of the Business Application >

I was expecting the value of the support group of the business application replace the <support group of the business application>

 

Thanks in Advance