- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-17-2018 07:54 AM
Hello everyone,
I have a record producer that I incorporated in Service portal.
One of the variables in the record producer is a widget.
What I am trying to do is communicate between catalog client script and the widget. What I want to achieve is when one of the variables change, I will do some manipulation in the widget controls. For this purpose I want to broadcast an event to the widget, just like you interact between 2 widgets.
But I can't seem to find a way to do it. There is no apparent way to communicate between the catalog client script and the widget.
Does anyone know how I can achieve this?
Thanks
Solved! Go to Solution.
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 04:35 AM
Probably a bit late for you, but this one is actually pretty simple.
You don't need to broadcast from a client script, you can have a widget react on a variable change using $watch:
$scope.$watch(function () {
return $scope.page.g_form.getValue('my_variable');
}, function (value) {
//Do stuff with value
}
I don't think it's possible to broadcast from catalog client scripts as $rootscope is not defined, but you should be able to handle any events needed with a $watch in this way, even if it is just by setting a hidden variable which is specifically being watched by your widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 04:35 AM
Probably a bit late for you, but this one is actually pretty simple.
You don't need to broadcast from a client script, you can have a widget react on a variable change using $watch:
$scope.$watch(function () {
return $scope.page.g_form.getValue('my_variable');
}, function (value) {
//Do stuff with value
}
I don't think it's possible to broadcast from catalog client scripts as $rootscope is not defined, but you should be able to handle any events needed with a $watch in this way, even if it is just by setting a hidden variable which is specifically being watched by your widget.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-11-2023 08:20 AM
Is anyone still following this thread? Im trying to do this in a catalog item widget and the console fills with errors.
js_includes_sp_libs.jsx?v=06-23-2023_1740&lp=Fri_Jul_28_06_14_53_PDT_2023&c=30_878:142 TypeError: Cannot read properties of undefined (reading 'getValue')
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎08-21-2018 05:17 AM
We have a winner.
Not late at all.
Amazing.
Thanks!