numeric variable display type change required.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 09:50 AM
Hi,
The requirement i have received is to have a numeric variable added to a Catalog item.
Default Appearance:- The only numeric variable - Numeric Scale variable type option seems to be appearing the below format in service portal:-
Appearance required:- However, the requirement is to have it in the below form in Service Portal:-
,
Please advise how this can be achieved for a Numeric variable in a Catalog item in ServiceNow ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 09:53 AM
@Vivek Kumar Tya Since the appearance you are looking to have is completely different than what numeric variable offers, you can choose to create a custom widget in angular and use the same with Variable type Custom with Label on your catalog item.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 09:56 AM
Hi @Sandeep Rajput,
Thanks for the advise.
Please if you could share more details on the same ?
How to implement it practically ?
Required code and implementation steps ?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 10:16 AM
Please refer to this article to know more about variable type custom with label https://www.servicenow.com/community/developer-articles/usage-of-quot-custom-with-label-quot-variabl...
Regarding the widget, I do not have the code handy with me. You can search for similar angular widgets online and implement the same using their source code in ServiceNow.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-09-2023 12:08 PM
Create a new Variable as shown below
For widget field click on search icon then New Record provide some name for that record & paste the below code
Html Code:
<!-- HTML markup for the numeric field with up and down arrows -->
<input type="text" ng-model="quantity" />
<button ng-click="increaseQuantity()">▲</button>
<button ng-click="decreaseQuantity()">▼</button>
Client Controller Code:
// AngularJS controller logic for the widget
function($scope, $http) {
$scope.quantity = 1; // Default quantity
// Function to increase quantity
$scope.increaseQuantity = function() {
$scope.quantity++;
};
// Function to decrease quantity (prevent negative values)
$scope.decreaseQuantity = function() {
if ($scope.quantity > 1) {
$scope.quantity--;
}
};
// Add additional logic to handle form submission, backend interactions, etc.
}
Save the record. Open the portal & check if the display is as per expectation.
Mark my answer helpful & accepted if it helps you resolve your query.
Thanks,
Danish