Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Message is not displayed when using addErrorMessage() or addShowmsg() on portal -
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Message is not displayed when using addErrorMessage() or addShowmsg() on portal
KB0713157

Message is not displayed when using addErrorMessage() or addShowmsg() on portal


8049 Views Last updated : Apr 7, 2024 public Copy Permalink English (Original)
  • English (Original)
  • Japanese
KB Summary by Now Assist

Issue

Symptoms


Error/Warning message will not display when we use addErrorMessage() or addShowmsg() on portal. Client script will run and message will appear and dissappear.

On console, warning is displayed when replicating the issue: synchronous use not supported in Mobile or Service Portal unless message is already cached

Release


Jakarta, Kingston, London

Cause


getMessage() has a second parameter client side, a callback function

Resolution


Adding callback function to the getMessage function will resolve the issue,

For example, change, if condition:

FROM:

if (newValue < start_date)
{
g_form.showFieldMsg('outage_end', getMessage("Outage End Date must be after Outage Start Date.), "error");
}
 
 
TO:
if (newValue < start_date){
getMessage("Outage End Date must be after Outage Start Date.",function(msg)
   {
g_form.showFieldMsg('outage_end', msg, "error");
})
}

Additional Information


-- Check this doc about about supported client side API's look under GliderRecord class.

-- If this is not your solution but symptoms are same. Check if your client script have "g_form.setValue('<field>',' ')" or clearvalue(). These method clear or set the value and also clear the message. Make sure add these lines before g_form.showFieldMsg()

Example:

This will clear the message and value both:

g_form.showFieldMsg('outage_end', msg, "error");

g_form.setValue('outage_end','');

 

Add setvalue before showFieldMsg:

g_form.setValue('outage_end','');

g_form.showFieldMsg('outage_end', msg, "error");

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.