Hide Submit Button on Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello, I have a requirement to hide the submit button on a catalog item if apps_listed_above = yes. I have a message on that field telling the user to stop and giving them instruction's on what to do. But we would like to hid or disable the submit button.
Thank you!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Step by step instruction is given in following KB:
KB0684408 Troubleshooting and Customization Guide for Service Portal Catalog Items
1. How to Hide the Submit Button for a Catalog Item in Service Portal
Purpose
To force users to use Add to Cart instead of the Submit button for specific catalog items.
Procedure
Clone the OOB Widget
- Open the SC Catalog Item widget: https://<instance>.service-now.com/sp_widget.do?sys_id=0fd6a6f247230200ba13a5554ee490b3
- Select Clone Widget.
Modify the Widget
- Open the cloned widget → Open in Widget Editor.
- In the HTML template, locate the Submit button element.
Original:
<button ng-if="::c.showOrderNowButton()" tabindex="0" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>Updated:
<button ng-hide="data.sys_id=='<sys_id of the catalog item>'" ng-if="::c.showOrderNowButton()" tabindex="0" name="submit" ng-disabled="submitted" ng-click="triggerOnSubmit()" class="btn btn-primary">{{submitButtonMsg}}</button>
Change the placeholder <sys_id of the catalog item> with the sys_id of your catalog item.
Associate the Widget with the sc_cat_item Page
- Navigate to Service Portal > Pages.
- Filter for ID is sc_cat_item.
- Open the page record.
- Select the Instance link next to SC Catalog Item.
On the widget instance → Widget tab → change the widget to your cloned version.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Thank you so much!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Hello @Darlene York
Hiding submit button on catalog item requires DOM manipulation which is not a recommended or best practice.
I would recommend a help text on the "apps_listed_above" variable and then stop record submission with an onSubmit Client script as shown below:
function onSubmit() {
var msgtobeDisplayed = 'As the apps_listed_above is yes then please stop now as this will not be submitted. Please adhere to instructions as what to do next,';
var appsLAVal = g_form.getDisplayValue('apps_listed_above');
alert(appsLAVal);
if (appsLAVal == 'Yes') {
alert(msgtobeDisplayed);
return false; // This prevents the form from being submitted.
}
}
Hope that helps!
