Display Field message in Incident .
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2022 11:59 PM
When we open any incident, it should display a Field Message under Caller as "No. of incidents with this Caller ID - ${get the count and display here}"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 12:17 AM
Can you share what you're stuck with in particular and what you've tried?
To help, you will want to do the following:
- Create a display business rule that grabs the user from the
caller_id
field (current.caller_id
) - In the business rule, use the
caller_id
to query the incident table by creating a GlideRecord - Populate the row count from your query in a g_scratchpad property
- Create a client script on the incident table that runs onLoad of an incident form
- Use
g_scratchpad
in the client script to access the count, and set it as a field message using:g_form.showFieldMsg("caller_id", "No. of incidents with this Caller ID - " + count, "info");​
Where
count
is a variable that holds the value stored as theg_scratchpad
property.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 12:33 AM
Actually I did not start this yet , I have no idea about scripting in service now , so can you describe me in details

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 12:17 AM
Hello,
Giving you hint
1) Write display business rule to get count of Incidents caller has, once you get the count store it in scratchpad variable
2) Write on load client script and fetch count value by calling scratchpad variable declared in Display business rule and use showfield message like below to display below caller
g_form.showFieldMsg('impact','Low impact not allowed with High priority','error');
Regards,
Musab
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-09-2022 12:41 AM
Hi,
Request you to start from your side as it would be learning experience for you as well.
You can use onChange client script on Caller + GlideAjax
In the GlideAjax function check how many incidents are there for that caller and then show field message
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader