Communicate between two widget instances that are of the same widget?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 05:58 AM
Good morning!
I have two widget instances (say A, and B) on a page that are using the same Data Table widget, with different instance options to pull data from different table sources.
When a record is clicked in widget instance A, I would like to pass the sysID of the clicked record to widget instance B to filter dynamically based on the sysID.
My question is.. is it possible to broadcast/emit the event from widget instance A and listen for the event in widget instance B? How can it be done since there is only one copy of the widget code?
My workaround to this is to clone the widget and customize the widget code a bit so that one widget broadcast, and the other widget listen. Though, I don't know if this is a best practice since the function of the widget is pretty much the same.
I also thought about creating a wrapper widget and embedded Data Table widget A and B.. it seems more complicated.
Any suggestion is welcome!
Thanks,
Jenny
- Labels:
-
Best Practices
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 06:04 AM
Hi Jenny,
You should be able to have the widget both broadcast and listen for events. Just like you are using the instance options to change the data source, you could use them to also determine which widget is broadcasting and which is listening.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 07:55 AM
Thanks Brad, I will give it a try.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 07:32 AM
Hello Jenny,
You may find the below blog helpful
How to communicate between widgets in Service Portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-01-2017 08:08 AM
Hi Pradeep,
Thank you for the response! Yes, I have read through that blog and find it helpful. It talks about communicating between two different widgets. I was hoping to find example of communicating between two instances of the same widget.
Regards,
Jenny