- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 04:13 AM
i want to redirect to an incident page by onsubmit using catalog client script
how to do this?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 07:02 AM
use this script,
var a = g_form.getValue('requested_variable_name');
var b = g_form.getValue('short_description_variable_name');
var c = g_form.getValue('description_variable_name');
var d = g_form.getValue('state_variable_name');
var url = "https://dev22966.service-now.com/incident.do?sys_id=-1&sysparm_query=requested="+a+"&sysparm_query=short_description="+b+"&sysparm_query=description="+c+"&sysparm_query=state="+d
g_navigation.openPopup(url);
check all the fields before run this script, It should work

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 04:53 AM
Hello,
you can user below statement in onSubmit script to redirect to another URL.
window.location.href='provide URL Here';
Note: This will cause the form to not get submit.
Not sure what is business requirement. If you can tell me the use case, then I may have better approach for the same.
Thanks,
Ali
Thank you,
Ali
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 05:09 AM
I have created four fields in a catalog and when i fill up the fields and when i click on ordernow it should redirect to an incident ticket.
this is the code :
function onSubmit() {
//Type appropriate comment here, and begin script below
var URL = "https://dev22966.service-now.com/incident.do?sys_id=d78ae3a2db55a300b364d170cf961930&sysparm_record_target=incident&sysparm_record_row=1&sysparm_record_rows=43&sysparm_record_list=active%3Dtrue%5EORDERBYDESCnumber";
top.window.location = URL;
var ga = new GlideAjax('incident');
ga.addParam('sys_id',g_form.getUniqueValue());
ga.addParam('caller_id', g_form.getValue('requestedfor'));
ga.addParam('state', g_form.getValue('state'));
ga.addParam('description', g_form.getValue('description'));
ga.addParam('short_description', g_form.getValue('shortt'));
}
i dont want to use record producer

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 05:12 AM
Use
getTopWindow().NavPageManager.get().getPane('gsft_main').loadLinkFromUrl("/incident.do?sys_id=d78ae3a2db55a300b364d170cf961930&sysparm_record_target=incident&sysparm_record_row=1&sysparm_record_rows=43&sysparm_record_list=active%3Dtrue%5EORDERBYDESCnumber");
Regards,
Chandra Prakash
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 05:20 AM
thanks for reply;
it didn't work and url should redirect to incident and map the catalog item fields to incident form