Service Portal widgets communication

dianemiro
Kilo Sage

Hello Everyone,

 

We have a requirement to optimize a page in Service Portal. Currently, all widgets are performing the same queries but each of the widget are performing gliderecord in the Server Script. We want to have the gliderecord in only 1 widget (Widget 1) and call or use the data from Widget 1 to use it on other Widgets (Widget 1, Widget 2, etc.).

 

Regards,
Diane

1 ACCEPTED SOLUTION

Hi @dianemiro,

 

Good point, I was investigating and found a different option:

 

Local Storage

 

This way in your first widget you can make the queries on the Server Side and use Local Storage as it gets saved on the user session and on the other widgets you can just use session.getClientData(object, param2), and all your data saved will be accessible. It solved a lot of performance issues in a particular use case that I had.

 

As per your question, broadcast does expect something to trigger an event so it can replicate data to another widget that is listening - but it can be tricky and you can maybe try this:

 

Angular run function on broadcast and page load

 

View solution in original post

5 REPLIES 5

Hello @Marcos Kassak,

 

I've tried this and put in something like this:

Widget 1

Server Script:

 

var session = gs.getSession();
session.putClientData('cService', data.service);

 

Widget 2

Server Script:

 

var session = gs.getSession();
data.clientService = session.getClientData('cService');

 

 

I'm trying to display this Service on my HTML Template using:

 

<div class="panel panel-success" ng-if="data.clientService">{{data.clientService}}</div>

 

 

But it displays nothing. May I know how can I display this on HTML Template correctly? Thank you!

 

Regards,

Diane