
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 04:03 AM
Hello Everyone,
We have a requirement where we need to create a Button on Catalog item once the user enter details once the user click on the button it should redirect to some 'x' table and write those records.
It should work on Catalog & as well as Serive Portal
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-24-2017 03:02 AM
Hello Azeez,
I have tried below code in Serviceportal and it worked for me.
HTML:
<input type="text" name="name" ng-model="inputValue" />
<button type="button" class="btn btn-danger btn-block" ng-click="c.setFieldValue(inputValue)">Value</button>
Client Controller:
function($scope) {
var c = this;
c.setFieldValue = function(uploadname) {
var g_form = $scope.page.g_form;
if (g_form.getValue('a1') != '') { // a1, a2 Replace with your variable names
g_form.setValue('a2', g_form.getValue('a1'));
g_form.clearValue('a1');
}
else {
g_form.setValue('a2', $scope.inputValue);
$scope.inputValue = '';
}
}
Reference:
Service Portal: Catalog Item Buttons — ServiceNow Elite
Thank You
Srikanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 04:35 AM
Hi Abdul,
So you want the button on the page for catalog item where all other variables are also present?
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
‎11-23-2017 05:02 AM
Correct Ankur,
Once the user the opens the item after entering all the details if the user press the button it should write in X table,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-23-2017 05:03 AM
Hi Abdul,
In this scenario you will require either UI page or UI macro as variable and have button in the html section.
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
‎11-23-2017 05:33 AM
Thanks Ankur,
I already created a button using UI page but where i got struck is how to pass all the variables info into the table;