UI Action - Showing error message on reload
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:12 PM
Hi,
I need to show an error message after clicking the UI Action button. It's displaying the error message but disappearing after 1 second.
How to show the error message after refreshing the page ?
Thanks
Ram
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:17 PM
Can you share your code? What type of error message is that?
harel
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:27 PM
Below is the code I'm using in UI Action(server side). If the condition met, I need to show the error message.
Right now, error message is coming but disappearing in a second. How can we show error message for long time or how to prevent the page reload after clicking the UI Action button ?
Please provide your inputs.
if <condition>
{
gs.addErrorMessage("a change task must be added before submitting the change");
action.setRedirectURL(current);
}
else
current.update;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:49 PM
Hi Ram,
Not sure why it disappears. Maybe you can share your condition as well?
I tested on my instance. My insights are few:
if <condition> {
gs.addErrorMessage("a change task must be added before submitting the change");
action.setRedirectURL(current);
} else {
current.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2017 12:54 PM
var grChtask = new GlideRecord('change_task');
if(!grChtask.get('change_request',current.sys_id))
{
gs.addInfoMessage("A Change Task must be added to the change " + current.number);
action.setRedirectURL(current);
}
else {
current.update();
}