Professional Documents
Culture Documents
The onSubmit client script on sc_cart is not called the second time
1378 views
Number: KB0551992 (https://hi.service-now.com/kb_view.do?
sysparm_article=KB0551992)
Description
The onSubmit client script on sc_cart is not called the second time.
Steps to Reproduce
1. Enable two step checkout model (glide.sc.checkout.twostep).
2. Go to Maintain Cart Layouts > Cart Preview Screen (Two step).
3. Enable all columns, buttons, and components,except for Shipping location.
4. Create the following client script:
Table: sc_cart
UI Type: Desktop
Type: onSubmit
Global: true
Script:
function onSubmit() {
var authMgr = gel('sc_cart.requested_for').value;
jslog('***DEBUG: authMgr = ' + authMgr);
if (authMgr == '') {
alert('Authorizing Manager is a required field. Please select a value before continuing.');
return false;
} else {
jslog("***DEBUG: WJH - Push Cart Values to Hints: else");
}
}
5. Order an iPad 3. On the checkout page (servicecatalog_checkout_one_v2), remove your name from the Requested For field.
The following error occurs on the console:
Workaround
This issue is fixed in the Helsinki release. If you are unable to upgrade, use the following workaround.
Change the client script. If you do not add a client script to check if Requested For is empty (or make any other field mandatory), then the checkout flow is not affected. If a client script has to be added, it has to re-set a boolean variable checkoutSubmitted (which is true when checkout has been clicked the first time) to false, so that checkout can be reset and becomes available again.
Table: sc_cart
UI Type: Desktop
Type: onLoad
Global: true
Sample Script: (Add the line in bold before returning)
function onSubmit() {
var authMgr = gel('sc_cart.requested_for').value;
jslog('***DEBUG: authMgr = ' + authMgr);
if (authMgr == '') {
alert('Authorizing Manager is a required field. Please select a value before continuing.');
checkoutSubmitted = false;
return false;
} else {
jslog("***DEBUG: WJH - Push Cart Values to Hints: else");
}
}
Seen In Fixed In
Helsinki Patch 1 Helsinki
Article Information
Last Updated:2016-08-01 08:52:22
Published:2015-10-16
https://hi.service-now.com/kb_view.do?sysparm_article=KB0551992 2/2