- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
I've been working on some form changes, and I've realised that while you can manipulate the label of a field within a catalog form using the setLabelOf(), the same onLoad script would not work on the RITM, and this is my experience currently.
Could you please validate if I'm missing something here - I have a field in a catalog form called 'directorships'. The label of the field is 'Mention the Directorships', and I'm using an onLoad client script to change the label of this field to 'Hello. This is the directorships label.' Whilst the latter label is displayed as expected on the portal, the submitted RITM still shows the old label.
@Ankur Bawiskar
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
For someone looking at this post in the future -
Summary -
We encountered an issue where long checkbox and multiple-choice labels (exceeding 255 characters) could not be stored in the variable Question attribute. To work around this, we tried updating labels dynamically using g_form.setLabelOf() in an onLoad client script. While this correctly updated the label on the catalog form, it did not reflect in the RITM, causing confusion during review. After investigation and confirmation from ServiceNow ( @Epapra Polugari), here are the key takeaways:
Root Cause:
g_form.setLabelOf() only changes the label on the client-side catalog UI.
It does not update the backend variable question, so RITMs, SCTASKs, notifications, approvals, exports, etc., continue to show the original (trimmed) label.
This is a platform limitation and expected behaviour.
Recommended Approaches:
Use a Rich Text Label variable
Add a Rich Text Label (or similar descriptive variable) above/below the checkbox.
No character limit; displays correctly in both catalog forms and RITMs.
Use Help Text or UI Policy Messages
Keep the variable label short.
Place the long compliance explanation in:
Help text
A Catalog UI Policy field message
A Rich Text/HTML container variable
Avoid using setLabelOf() for data that must be stored or audited.
It only affects the browser view and does not propagate to backend records.
Regarding Extending the Question Attribute Length
Increasing the max length of the Question field is not recommended.
The variable label is used across the platform (RITMs, tasks, approvals, exports, PDFs, emails).
Longer text can:Impact performance (label rendering happens frequently)
Reduce readability across downstream processes
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago - last edited 3 weeks ago
it doesn't work in backend and only works in catalog form
you might have to use DOM manipulation for this
Note: DOM manipulation is not recommended
check this link which has script from Chaitanya
New help on changing the variable label text.
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Thank you for marking my response as helpful.
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi @Akshay Bhaskar ,
Please check below links,
https://www.servicenow.com/community/developer-forum/setlabelof-not-working/m-p/1791751
Please mark my answer correct and helpful if this works for you
Thanks and Regards,
Sarthak
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
@Akshay Bhaskar Please see this KB article from support https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0758098