How to display a banner message on the itil login home page?

rev
Kilo Contributor

Hey everyone,

right now I'm trying to display a message on the Itil service now homepage based on the value of a field value on an incident form. I've done some research and so far haven't come up with much. Would anyone be able to point me in the right direction?

Thanks,

Rob

1 ACCEPTED SOLUTION

reedowens
Tera Contributor

Here is a dynamic content block to use as a starting point.



message_jelly.png



Add the Message content block to the spot on the page you want.   I added above the header and this is what it looks like:



result.png



And here is the code to copy:



   
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate>
   var gr = new GlideRecord('incident');
   gr.addActiveQuery();
   gr.addQuery('priority', '=', '1');
   gr.query();

   var foundIt = false;
   if (gr.hasNext()) foundIt = true;
</g:evaluate>
 
<j:if test="${foundIt}">
   <span class="my-message-class" style="background:red;color:black;">You have a priority 1 Incident</span>
</j:if>
</j:jelly>

View solution in original post

10 REPLIES 10

reedowens
Tera Contributor

Rob,



Can you provide a more detail explanation of what you are trying to accomplish?  



What is the ITIL Login Home Page?   Is it a home page that someone with the ITIL role sees when they log into the CMS Site?



Is the "banner message" to appear when they look at an incident?   If that is the case, use a Business Rule.  



Straight from the wiki:


Business rule and other general use

  • current.field_name.setError("Hello World"); Will put "Hello World" below the specified field
  • gs.addInfoMessage("Hello World"); Will put "Hello World" on the top of the screen

rev
Kilo Contributor

Hey Reed,


sorry if I was vague. Pretend that I have a field value of type choice(called "Options") on an incident form. Options has three values: 1. None 2. OptionA 3. OptionB. Basically if the user selects any choice other than none, I would like to display a message on the homescreen (first screen an ITIL user sees after they log onto the Service Now instance) saying "OptionA has been selected". These are just pseudo names but the functionality is what I'm trying to implement. I hope that clears it up.



-Rob


reedowens
Tera Contributor

Rob,



So let me restate...  



On a Home Screen you want something that queries for all incidents that meet a certain query ( assigned to user, open, group, etc)   Then looking at the incidents that are returned, you want to show a message that Option A, Option B, Option C was selected.



or



On a Home Screen, the user selected something to make them fill in an Incident Form or update an existing incident.


If they select Option A then you want a message to appear on the "Current" screen.


rev
Kilo Contributor

I apologize. I'd like for it to query all incidents that meet a certain query, and then show that an option on selected