- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-10-2022 11:26 PM
hello.
How can I run catalog client scripts in Service Portal widgets?
I wrote the following in the client controller, but it didn't work.
var c = this;
c.setTotalAmount = function() {
// catalog client script
TotalCalculation();
};
Please help me.
Regards,
Ro
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2022 12:21 AM
in the client controller you can access variables of catalog item
Like this
Ensure $scope is set as a parameter in your client controller function as below
api.controller = function($scope) {
//Use the below syntax to access catalog variable value
}
$scope.page.g_form.getValue('variable_name');
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-10-2022 11:44 PM
is the function TotalCalculation() present inside some catalog client script?
Why to invoke? why not do the calculation in widget only?
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-11-2022 12:11 AM
TotalCalculation() does indeed exist in the catalog client script.
I would like to sum some variables in a catalog item.
Where do you do the calculations in the widget?
Regards,
Ro
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-11-2022 12:21 AM
in the client controller you can access variables of catalog item
Like this
Ensure $scope is set as a parameter in your client controller function as below
api.controller = function($scope) {
//Use the below syntax to access catalog variable value
}
$scope.page.g_form.getValue('variable_name');
If my response helped please mark it correct and close the thread so that it benefits future readers.
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-11-2022 01:36 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader