Short Description must change Dynamically
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
I need help in changing the record producer short description dynamically when particular state users opens the record producer. I created a label type variable as short description and written onload client script can anyone help with working code.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
record producer short description cannot be dynamic
As a workaround do this
-> keep short description of record producer as empty
-> create multiple HTML type variables and store the content in it particular to each state
-> then use onLoad catalog client script and check state of logged in user and then hide the other HTML variables
💡 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
2 weeks ago
Just a quick follow-up—were you able to review the suggested approach?
Please let me know if you need any assistance.
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
Hi @SaiMounikaY
Try with this
- Create onload Catalog Client script
function onLoad() {
g_form.getReference('sys_user', function(user) {
if (user.state == '<YOUR_TARGET_STATE>') { // Replace with actual state field name and value
g_form.setValue('short_description', 'Your Custom Short Description');
} else {
g_form.setValue('short_description', 'Default Short Description');
}
});
}
- Record Producer Script (Server-Side)
Because Client Scripts only affect the UI, ensure the mapped value applies to the final generated record (like an Incident) by using the Record Producer's script field.
var userGR = new GlideRecord('sys_user');
if (userGR.get(gs.getUserID())) {
if (userGR.state == '<YOUR_TARGET_STATE>') {
producer.short_description = 'Your Custom Short Description';
} else {
producer.short_description = 'Default Short Description';
}
}
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti