The CreatorCon Call for Content is officially open! Get started here.

Display Field message in Incident .

Amit Dey1
Tera Contributor

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}"

4 REPLIES 4

Nick Parsons
Mega Sage

Can you share what you're stuck with in particular and what you've tried? 

To help, you will want to do the following:

  1. Create a display business rule that grabs the user from the caller_id field (current.caller_id)
  2. In the business rule, use the caller_id to query the incident table by creating a GlideRecord
  3. Populate the row count from your query in a g_scratchpad property
  4. Create a client script on the incident table that runs onLoad of an incident form
  5. 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 the g_scratchpad property.

 

Actually I did not start this yet , I have no idea about scripting in service  now , so can you describe me in details 

Musab Rasheed
Tera Sage

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');


Please hit like and mark my response as correct if that helps
Regards,
Musab

Ankur Bawiskar
Tera Patron
Tera Patron

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

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader