I want to call a widget from another widget in Service Portal.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-04-2018 05:55 AM
I want to call a widget from another widget in Service Portal. A parent widget is in the macro variable of a catalog item.. and there is a child widget containing few data.. I want to call the child widget in Parent widget and use the data in parent.
Childwidget will contain some server side script like :
var htmlname = "<some_text_here">;
data.htmlsysid = "<some_sysid>";
I want to send the data of child widget to parent widget and use it in parent widget.
Can anyone help here?
- Labels:
-
Service Portal Development
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 02:14 AM
Hello Sachin,
I tried the same from the given link. But i couldn't send the data in another widget. No alert or console.log coming.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 01:19 PM
down voteaccepted | On the Client Script, you can put your data to send to the Server Script in to Client Script
Server Script
A good tutorial about this is at https://serviceportal.io/communicating-between-the-client-script-and-the-server-script-of-a-widget/ |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-05-2018 02:07 PM
I would not use $rootScope in the first widget to store the variables, only to broadcast the event.
Try something like: $scope.htmlvarname = c.data.htmlvarname
Also I am assuming you want to pass the actual data in the event, not a string? get rid of the second ' '
Second widget seems to be OK, I guess you can use both $rootScope.$on and $scope.$on, I always do the latter.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-07-2018 11:09 PM
Now the data is coming into my another widget with the help of timeout function. But because of timeout the data is coming in delay, hence I am not able to send it to server side because it is loaded first. Any way to send the data after the timeout function is loaded ?