- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:16 PM
I want to add button on service catalog form ---> "Reset", which will clear all variables values.
Solved! Go to Solution.
- Labels:
-
User Interface (UI)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:56 PM
Hello
you can create a custom type variable and tag your widget in that variable which will render the button on the catalog form
please try below code in the widget
Html:
<button type="button" class="btn btn-danger btn-block" ng-click="c.clearValue()">Reset Values</button>
Client controller:
api.controller=function($scope) {
/* widget controller */
var c = this;
c.clearValue = function() {
alert('test');
var g_form = $scope.page.g_form;
var allFields = g_form.getFieldNames();
alert(allFields);
for(var fieldName in allFields){
g_form.setValue(allFields[fieldName],'');
}
};
};
Please try this and if it works please mark my answer as correct
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:27 PM
Hi Ganesh,
If the user refreshes the browser it wipes all the fields so the form can be started over.
Thanks,
Adam
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:39 PM
Hi Adam,
Thank your response but I want button over the form.
Thanks,
Ganesh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:28 PM
Hi Ganesh,
Check this link please
https://community.servicenow.com/community?id=community_question&sys_id=ba4bb2fbdb239810fa192183ca96...
Mark Correct or Helpful if it helps.
***Mark Correct or Helpful if it helps.***
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2022 02:43 PM
Hi Yousaf,
Thank you for your response, I already review that link but macro variable type is not available in Rome Or San Diego version.
Thanks,
Ganesh