Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to redirect a User to a custom page when a particular catalog item is ordered instead of default

Ankur Khare
Tera Contributor

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?

1 ACCEPTED SOLUTION

RobCook86
Tera Expert

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
}

View solution in original post

16 REPLIES 16

Ankur Khare
Tera Contributor

@Ankur Bawiskar Yes I am waiting because OOB when we click on Order Now on catalog item it routes to Check out page as below .

AnkurKhare_0-1748495300475.png

 

Therefore in order to route to my custom page I have given wait time because it skips the above checkout page and at backend the request is not created and directly routes to my custom page.

Therefore I am holding it for sometime so that request gets created and then it routes to custom page

 

@Ankur Khare 

Thanks for sharing

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader