How to get changed/updated reference value for widget communication for catalog item in service portal?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-20-2018 10:47 AM
Hi Community,
Requirement
I have a requirement where I have to create a widget that would display all the assets assigned to a user on a catalog item. User name can be selected/ changed on 'requested_for' variable.
To do this I have created a widget and replaced it with UI macro type variable on portal and I'm able to get assets of currently logged in user. However, as per requirement, If my user name is changed in requested for variable, my asset list should be updated to newly selected user's assigned assets.
Issue:
I'm not sure how to get the changed/updated value of my "request_for" [ reference : sys_user ] variable. I looked in sc_cat_item widget and it is using 'sp-model' directive to create form for catalog item and as per my current knowledge and findings, code for this widget is not available. I don't know if there is emit or broadcast on sp-model controller that I can listen to get updated value or service now use other method to make information of these changes available.
It would be helpful if someone can provide more info related to this 🙂
Thanks
Sagar
- Labels:
-
Service Portal Development

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-22-2018 08:20 PM
I have used the below method to detect field changes for regular form fields. I think there is a good chance this would work for catalog fields as well, though I haven't tried it yet. Put this into your widget's client controller and let me know how it goes (make sure you pass $scope into your client controller function):
$scope.$on("field.change", function(evt, parms) {
console.log(parms.field.name);
console.log(parms.newValue);
// do whatever you want to do here to refresh
// your data based on the changed value
});

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-20-2019 10:01 AM
I've tried many methods but this is the best way to do this. Clean and provides the field, oldValue and the newValue. Wish I could click helpful twice.