Limit Quantity to 2 on the order guide for specific catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2026 01:18 PM
Hi ,
I want to limit quantity to 2 on the order guide for specific catalog item.
Thanks in Advance!
Harika
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2026 08:35 PM
did you configure the quantity for that item?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-10-2026 09:37 PM
This is the snippet in the server code that collects the choices for quantity. If you look at the html template you'll notice that all the items will use the same array of choices.
function getQuantityChoiceList() {
var clGenerator = new GlideChoiceList();
var choiceListQuantity = clGenerator.getChoiceList("sc_cart_item", "quantity");
var choicelistQuantityData = [];
for (var i = 0; i < choiceListQuantity.size(); i++) {
var choice = choiceListQuantity.get(i);
if (!isNaN(choice.getValue()))
choicelistQuantityData.push({
value: parseInt(choice.getValue()),
label: choice.getLabel()
});
}
return choicelistQuantityData;
}Which means you will have to edit where the options come for the ngRepeat directive. E.g something like this
<select id="catItemQuantity" ng-change="updateQuantity(item)" class="scBasicSelect" ng-model="item.quantity">
<option ng-repeat="num in item.quantitylist" <!-- can't use 'static' choiceListQuantity --> value={{::num.value}}>{{::num.label}}</option>
</select>item = $sp.getCatalogItem(itemData);
//add logic here to create your choicelist in some way. Item object has plenty of information about the catalog item in question
if (item.sys_id == "e56b521883313210557ff0d6feaad322") {
item.quantitylist = [{ value: 1, label: "1" }, { value: 2, label: "2" }]
} else {
item.quantitylist = data.choiceListQuantity
}
item.quantity = item.quantitylist[0].label
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2026 01:12 PM
Hi Lauri,
The script which you referring is from the OOB SC Order guide but this widget is High risk file. Which will effect in the future upgrades.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-11-2026 02:07 PM
Despite what the community often says, customization only adds risk as in adds to the potential of negative outcomes it's not an automatic no-no. If you have good governance then it is fairly simple to keep the widget "up-to-date" during upgrades. The problems arise when nobody knows why something was done and who owns it. The platform exists to support the processes at your org, granted they should be somewhat logical and follow good ux practices.
There are many ways to achieve the same effect. What you do depends on the implementation and how established and rigid your catalog practice is. People typically resist change so I can predict business would want this widget change rather than adopt using e.g bundled models or whatever.
As said the choice list is pulled from the dictionary so you can't alter it item by item as it uses the same choicelist for all items. You can for example remove the quantity option for the item and get the quantity in the describe needs part.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Limit quantity to 2 on an Order Guide for a specific catalog item.
Solution Approach
There are two ways to do this:
Option A: No-Code (Recommended)
On the catalog item record (sc_cat_item):
- Set Max Quantity field (max_quantity) to 2
- This is OOTB and enforced automatically in the Order Guide and catalog
Option B: Client Script (if max_quantity field isn't available or you need custom validation)
Create a Catalog Client Script on the Order Guide:
- Type: onSubmit
- Applies to: Order Guide
- Table: N/A (Order Guide level)
function onSubmit() {
var targetItemSysId = 'YOUR_CATALOG_ITEM_SYS_ID';
var maxQty = 2;
// Get quantity for the specific item in the order guide
var qty = parseInt(g_form.getValue('quantity_' + targetItemSysId), 10);
if (qty > maxQty) {
g_form.addErrorMessage('Maximum quantity for this item is ' + maxQty + '.');
return false;
}
}
Option C: UI Policy (no scripting)
- Create a UI Policy on the Order Guide
- Condition: quantity field > 2
- Action: Show error / set value back to 2
Recommendation: Start with Option A (max_quantity = 2 on the catalog item). It's the simplest, requires no code,
and ServiceNow enforces it across all ordering channels (portal, platform, Order Guide).
