How to dynamically populate checkbox in a Service Catalog Item from a client-side JSON buffer
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I am building an integration use case within a Service Catalog Item.
- The user enters a change request number (CR/CTR).
- An asynchronous GlideAjax script fetches matching records from an external ServiceNow instance table and stores the raw JSON payload in a hidden text variable acting as a local cache buffer (u_data_buffer).
- The catalog item filters this JSON buffer to populate unique Billing Account Numbers (BAN) into a native drop-down selection field.
When a user selects a specific BAN, the form must display a list of all related MSS IDN codes (retrieved from the cached JSON buffer). Crucially, the customer needs to be able to select multiple MSS IDN values for that single BAN.
Since we are not referencing a live local table on our instance (the data lives strictly inside the client-side JSON buffer), we cannot use a standard List Collector variable.
- g_form.setLabelOf() – This fails because checkboxes are structural elements rather than typical inputs, and this native API does not change the label text of catalog checkboxes.
- DOM Manipulation & jQuery UI Overrides – Unchecking Isolate Script and attempting to target selectors like document.getElementById('label_' + ...), document.querySelector, or $j('label[for=...]') either completely fails to alter the text or errors out with TypeError: Cannot read properties of undefined in the Service Portal runtime workspace.
- Native HTML/Custom Macro Variables – Injecting raw checkbox template strings dynamically via .innerHTML directly into a custom widget macro container element.
- Standard Select Box (with 'Multiple' checked) – Browser native multi-select options aren't successfully capturing or updating the dynamic options cleanly in our current portal layout wrapper.
How can I cleanly achieve a multi-select choice list UI inside a Catalog Item where both the Choice Values and Choice Labels are generated purely dynamically on the fly from a client-side JSON string array? Is there a clean, upgrade-safe workaround to change Checkbox variable labels dynamically on the Service Portal, or should I structure this configuration differently?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
my thoughts
-> don't use native checkbox variable for this
-> use a custom widget to show the checkboxes
Share your current approach along with screenshots
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
To implement a dynamic multi-select choice list for MSS IDN codes based on the selected Billing Account Number (BAN) in a ServiceNow Catalog Item, use a List Collector variable along with an onChange Client Script.
The script dynamically filters and populates the available options using data retrieved from a JSON string.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti