How to create Reset button in catalog item
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 05:04 AM
Hi Team,
I want to add a button in my catalog item as Clear Values and on clicking the button, it should clear the field values.
Please help.
Thanks in advance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 05:48 AM
Hi Team,
Thanks for your reply. Actually my query to show the button on catalog item same as submit or order now button while raising the request.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 06:01 AM
Hi Vaishanvi,
Create a button type as submit and write onSubmit Client script but instead of submit you can clear values. Add return false at the end in the code that i gave you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 06:04 AM
Hi,
So are you saying you want to clear the values when user clicks on button in the catalog form during submission?
if yes then you need to use UI macro and button inside it and then clear all the variables for the current catalog item
Remember you will have to use macro with widget for portal to work
How to display UI macro in service portal catalog form
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-06-2020 06:04 AM
Have you looked at the update from
That links to a page explaining how to create a widget that contains a button.
Reset Button or Clear Values button widget to clear catalog item variable values
Step 1: Create a widget as shown below
Body HTML Template:
<button type="button" class="btn btn-danger btn-block" ng-click="c.setFieldValue(inputValue)">Reset Values</button>
Client Controller script
function($scope) {
var c = this;
c.setFieldValue = function (uploadname) {
var g_form = $scope.page.g_form;
g_form.clearValue("acrobat");
g_form.setValue("Additional_software_requirements", "");
g_form.setValue("test", "");
g_form.setValue("photoshop", "");
};
}
Step-2: Create a variable of type Macro and in the default section give this widget name.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-19-2022 01:37 PM
Hi Vaishnavi,
Are you got solution for the same?
thanks,
Ganesh