Can not get the sent Options of the embedded widget

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 04:17 AM
Hi,
I created a new widget with an embedded widget. I'm trying to sent params from the new widget to the embedded widget.
1) Parent widget:
HTML:
<div class="embedded-widget">
<sp-widget widget="c.processflow"></sp-widget>
</div>
Client controller:
spUtil.get("process-flow", {table:"change_request"}).then(function(response) {
c.processflow= response;
});
2) Embedded widget:
Client controller:
console.log("Table: "+c.options.table);
Server script:
console.log("table: "+input.options.table +" - "+options.table);
All of these results for "console.log" are undefined.
Cheers,
Serkan
- 3,387 Views

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 05:02 AM
the only way I know of to get info from one widget to another is by broadcasting it. I don't think the parent/child relationship of the embedded widget and the embedding widget matter. You could set up the parent widget to have the child-widget's options as well, and then broadcast them, maybe?
Perhaps start here?: Link - How to Communicate Between Widgets in ServicePortal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 05:42 AM
Hi Andrew,
It's possible to sent options from the "parent" widget to the embedded widget with a Client Controller script:
Client Controller:
spUtil.get("process-flow", {sys_id:"test sys id"}).then(function(response) {
c.processflow= response;
});
And to get the "sys_id" in the embedded widget: process-flow
Server script:
console.log("sys_id: "+input.sys_id); |
But my structure is a little bit different, because in the described example at the top, we are calling a widget one times.
In my structure I'm embedding this widget multiple times in a "ng-repeat".
I read on a website that you can use the following:
<sp-widget widget="c.data.processflow" options="{sys_id: 'test sys id'}"></sp-widget>
But this is not working for me...

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 05:50 AM
it sounds like what you're having trouble with is getting the data back from the child widget in the ng-repeat, yes?
Have you thought about instead of imbedding another widget, taking the imbedded widget and turning it's view component into a template, and then combining the controllers?
I only ask because I know how to do that^^ but I don't have any idea how to get data back from an imbedded widget. In all the cases I've seen, the parent widget is usually just a kind of wrapper that doesn't do much. (e.g. Homepage Search)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2016 05:57 AM
I don't want data from the embedded widget into the parent widget. The parent widget needs to send data to the embedded data as options...
I'm not familiar with the your proposal, template.. Do you have links, examples etc. for me?