Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

send data from one widget to other

Rosy14
Kilo Sage

Hi, I have 2 widgets. I want to send a data to other widget. in second widget data is not coming.

 

Widget 1:

 

HTML:

 

<button class="btn btn-primary action-btn pull-right" ng-click="selectItem(item.u_zoom_link)">Register</button>

 

Client script:

 

$scope.selectItem= function(eventObj){
alert(eventObj);  //Working
c.selectedEvent= eventObj;
$rootScope.$broadcast('showEventDetails', eventObj);
};

 

Widget 2:

 

HTML:

 

<p>
Test: {{c.showForm}}  //Not working
</p>

 

Client Script:

 

function($rootScope) {
  var c = this;
      c.showForm = "";
        //Listening for "showEventDetails" event
  $rootScope.$on('showEventDetails', function(event,obj) {
alert("test"); // Not coming
            c.showForm= obj;
  });
}
 
1 REPLY 1

Ankur Bawiskar
Tera Patron
Tera Patron

@Rosy14 

this link has the approach. you need to broadcast

How to comunicate between widgets - Service Portal 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader