- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-14-2016 04:13 PM
Hi All,
We are running Helsinki patch 5 and have started to look at implementing the shopping cart in the Service Portal. The problem we are having is trying to make fields mandatory. See screenshot below showing the field we would like to make mandatory:
We have client script code that is set to run for both mobile and desktop set for the UI type. This works in the Service Catalog but not in the Service Portal when attempting a checkout without a Business Justification set. I am assuming I need to set this in the client script of the widget in question, just not sure where to start with the code for this.
Does anyone have some links to good resources to help with developing widgets?
Thanks
James
Solved! Go to Solution.
- Labels:
-
Service Portal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 08:50 AM
James,
I'd first like to caution you about leveraging the Helsinki Patch 5 shopping cart widgets. We're not sure why they were included since the Shopping Cart and Bundles in Service Portal are most likely not being released until Istanbul.
That said, it appears from your screenshot that you are trying to make the relabeld Special Instructions field, "Business Justification", field mandatory in the "SC Shopping Cart" widget.
The HTML for that field is in the sp_ng_template called "large_shopping_cart.html" record:
Since you've already taken ownership of the "large_shopping_cart.html" template record you could add in a "placeholder" value that also draws attention to the mandatory nature of this field.
You could add the following to the "Client Script" on the "SC Shopping Cart" widget
Between Lines 13-14 add the following:
if (c.additionalDetails == '') {
- spUtil.addErrorMessage('Business Justification is required before Checkout. Thank you!');
- return;
}
And you could add some CSS to the "SC Shopping Cart" widget to draw attention to the mandatory "Business Justification":
I'm adding minimal CSS here but you could go further...
.special-instructions-details label {
color: tomato;
}
Results:
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-15-2016 03:54 PM
Thanks all for your responses.
Brad, yes it appears I was using unsupported code in the client script.
Jeremy, that worked for me thanks very much.
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-16-2018 11:53 AM
HI All,
Some one help me to write a script in the SC Shopping cart widget line manager can't be an approver(vice versa).Line manager is auto populating from user profile data and also user can manually change their line manager