- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-24-2017 09:48 PM
Hi all,
I'm doing something on a UI page, and I'd like to control where the form / system messages appear. These ones:
gs.addInfoMessage("I am a message");
At the moment, ServiceNow automatically places them at the top of the page, but I'd like to control where they appear on the page, within another element.
From what I can see, it automatically adds a div that looks like:
<div class="outputmsg_div">
<div class="outputmsg_container" style="display:" id="output_messages">
<button class="btn btn-icon close icon-cross" onclick="GlideUI.get().clearOutputMessages(this); return false;"><span class="sr-only">Close Messages"</span></button>
<div class="outputmsg_div">
<div class="outputmsg outputmsg_info notification notification-info">
<img title="" class="outputmsg_image" src="images/outputmsg_info_24.gifx" data-original-title="Informational Message">
<div class="outputmsg_text">I am a message</div>
</div>
</div>
</div>
<script>addRenderEvent(function() {CustomEvent.fire('glide_optics_inspect_update_watchfield', '');});</script>
</div>
Anyone know how to control where messages appear on a UI page?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 10:25 PM
I found a way to do it.
It involves
- grabbing the messages
- flushing all messages
- displaying them in div's classed the same as notifications usually are.
<g:evaluate var="jvar_msg_info" object="true" expression="gs.getInfoMessages();">
<g:evaluate var="jvar_msg_error" object="true" expression="gs.getErrorMessages();">
<g:evaluate>
gs.flushMessages();
</g:evaluate>
<div class="outputmsg_div">
<j:forEach var="jvar_value" indexVar="jvar_key" items="${jvar_msg_info}">
<div class="outputmsg outputmsg_info notification notification-info">${jvar_value}</div>
</j:forEach>
<j:forEach var="jvar_value" indexVar="jvar_key" items="${jvar_msg_error}">
<div class="outputmsg outputmsg_error notification notification-error">${jvar_value}</div>
</j:forEach>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-26-2017 02:30 AM
Hi David,
infoMessages are always displayed at the top of the form and it comes from ServiceNow platform. you cannot change that.
What is your exact requirement?
Do you want to show infoMessage at some other place or you are asking some question regarding UI page messages i.e. alert etc
Mark Correct if this solves your issue and also hit Like and Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-28-2017 04:04 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 10:25 PM
I found a way to do it.
It involves
- grabbing the messages
- flushing all messages
- displaying them in div's classed the same as notifications usually are.
<g:evaluate var="jvar_msg_info" object="true" expression="gs.getInfoMessages();">
<g:evaluate var="jvar_msg_error" object="true" expression="gs.getErrorMessages();">
<g:evaluate>
gs.flushMessages();
</g:evaluate>
<div class="outputmsg_div">
<j:forEach var="jvar_value" indexVar="jvar_key" items="${jvar_msg_info}">
<div class="outputmsg outputmsg_info notification notification-info">${jvar_value}</div>
</j:forEach>
<j:forEach var="jvar_value" indexVar="jvar_key" items="${jvar_msg_error}">
<div class="outputmsg outputmsg_error notification notification-error">${jvar_value}</div>
</j:forEach>
</div>
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-08-2017 03:59 AM
Hi. I am facing some issue regarding to message in UI Page.. For one specific user, the message is not getting displayed. Any idea why is it happening?