- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 06:51 AM
I want my Record producer to redirect to a homepage after submitting the record with a message of the RITM submitted?
I am trying with this code but still it is not redirecting me to the home page and redirects me to the RITM page.
function onSubmit() {
//Type appropriate comment here, and begin script below
function onLoad() {
setTimeout('clearMsg()', 4000);
}
function clearMsg(){
g_form.clearMessages();
producer.redirect = producer.redirect = "https://katerradev.service-now.com/nav_to.do?uri=/home.do"
//action.setReturnURL(current);
//window.top.close();
}
}
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 07:25 AM
In your record producer script
The below is what I've used for an incident which redirects to the service catalog screen. Adjust the message to your needs.
- var msg = "The incident " + current.number + " has been opened based on your report.<br/>";
- msg += "Due to the potentially sensitive nature of the accident, viewing is restricted to the Facilities team.<br/>";
- msg += "They will contact you if they require any further information.";
- producer.redirect = "catalog_home.do?sysparm_view=catalog_default";
- gs.addInfoMessage(msg);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 06:55 AM
You don't want to put redirect logic in the onSubmit script, because the user will be redirected before the request is submitted. Also, the producer.redirect variable is a server-side component, which will not work in a client-side script. You are best working this logic and using the variable in the record producer script itself.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 06:56 AM
Have not put the message line yet but I am not sure How shall I put it..
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 07:01 AM
You can use the gs.getMessage() function in the producer script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-13-2017 07:04 AM
So you're script would have something in the format of:
gs.addInfoMessage('Hi there');
producer.redirect = "url_comes_here";