Show info message in ui action
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 01:08 AM
Hi team,
on problem we have field pending (check box) and this is showing in the root cause analysis state if you want move to the next state you have to uncheck the pending so the requirement is i have to show info message to the user when user clicks on fix if pending check box is true "uncheck the pending in order to move to next state" can anyone help me in the script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 01:37 AM - edited 04-03-2025 01:38 AM
Hi there,
it will be a onChange client script with condition on the state change (in the condition line) and put the condition that the variable "pending" is true, then add a code:
gs.addInfoMessage("Your message!!!"); //to be in blue colour
gs.addErrorMessage("Your message!!!"); //to be in red colour
if the variable is false, the code will not be executed and thus not displaying the message
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 01:52 AM
then is your UI action client side?
if yes then simply check the value and show info message
if(g_form.getValue('pending') == 'true'){
g_form.addInfoMessage('uncheck the pending in order to move to next state');
}
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-03-2025 02:00 AM
Hello @Shabbir1
Client script will not work here, because you are talking about "UI ACtion" - "Fix" . so you need to add in the UI Action in the Server part of script
gs.addInfoMessage() and also you can abort the action from there - current.setAbortAction(True).
You can share screenshots whil you are trying this out and I can assist if you encounter issues.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY QQ