Portal- Refreshing embedded widgets by option value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2016 01:43 PM
In my Service Portal widget, I have an embedded widget that I am passing different record producer sys ID's into.
The approach I'm taking is using the client script to pass data to the server script as input.
The problem I'm seeing is that once the widget is loaded, I can't reload that widget using different option values.
HTML
<sp-widget widget="c.data.recordProducerWidget"></sp-widget>
Client Script
$scope.showRPSoftware = function() {
$scope.data.someID = "12345abcd";
spUtil.update($scope);
}
Server Script
data.recordProducerWidget=$sp.getWidget("sc-catalog-item", {sys_id: input.someID}); |
Any insight into how I can dynamically reload a widget from a client script would be great.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-04-2016 03:34 PM
Try this:
HTML
<div class="elementRow" ng-if="c.data.recordProducerWidget">
<sp-widget widget="c.data.recordProducerWidget"></sp-widget>
</div>
Client Script
$scope.showRPSoftware = function() {
$scope.data.someID = "12345abcd";
renderWidget('sc-catalog-item', {sys_id: $scope.data.someID});
}
function renderWidget(widgetID, params) {
c.data.recordProducerWidget = null;
spUtil.get(widgetID,params).then(function(response) {
c.data.recordProducerWidget = response;
});
}
// REMOVE SERVER SCRIPT.
Server Script
// | data.recordProducerWidget=$sp.getWidget("sc-catalog-item", {sys_id: input.someID}); | |

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 09:16 AM
I gave a thumbs-up because it seems like this is going in the right direction, but just as Serkan said, I keep getting "undefied".
For detailed info, see my post here: Re: Dynamically changing $sp.getWidget options in Client Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-12-2017 01:23 PM
Got it to work. Answer here: Re: Dynamically changing $sp.getWidget options in Client Script

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-23-2016 04:12 AM
Hi Vincent,
Do you get the given params from the "parent" widget in the embedded widget?
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