- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 05:02 AM
Hi Team,
We have a requirement wherein there is a particular catalog item for which if a person clicks in Order Now button it should route to a custom page which we designed instead of generic com.glideapp.servicecatalog_checkout_view_v2.do?v=1&sysparm_sys_id=c36602fa2be166103d13f0845e91bf02&sysparm_new_request=true&sysparm_view=ess&sysparm_catalog=e0d08b13c3330100c8b837659bba8fb4&sysparm_catalog_view=catalog_Service_Catalog
We have written onSubmit client script but its still routing to the above view.
Can you tell how to achieve this?
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2025 05:45 AM
You need to set the return action to false when you click order now. If its just for this one item change your on submit client script to the following:
window.location.href = '/sp?id=pd_bar';
return false;
if not you can place a check in there to list the item you are using like this:
function onSubmit() {
var itemSysId = g_form.getUniqueValue();
// Optional: check for specific item sys_id if reused
if (itemSysId == 'your cat item') {
window.location.href = '/sp?id=pd_bar';
return false; // Prevent default submission
}
return true; // Let others pass
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 01:48 AM - edited 05-28-2025 01:48 AM
Actually later on I made further changes and it was fixed via below script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 02:19 AM
can you explain what that code does?
Does it work in native and portal both?
It would be helpful to other members
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-2025 03:06 AM
Yes it works for both native and Portal.
Earlier I was using window instead of Parent and it was not routing to the custom Page i created instead it was routing to Checkoutform which OOB for the catalog item. I wanted to route this to my custom page in the portal. With the help of parent it started working
When you do window.location = targetPage; it tries to redirect only the iframe itself — that means only the inner frame changes URL.
However, if you want to redirect the whole portal page (the top-level or parent window), you must assign to parent.location
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-28-2025 05:41 AM
you are doing a poll every particular seconds?
Is it that you are waiting for the ajax response to come?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Monday
How did you obtain the request sysid in the client script, and what exactly are you executing in the script include? Could you please share the code?
