Need help on passing sys id to another widget in service portal

shaik_irfan
Tera Guru

Hi,

 

I am learning Service Portal, i have created 2 widgets and added into an page. In the Widget 1 i have a reference type field when i select any record i get the sys id which i want to pass to another widget. 

 

After looking at few articles i came to know this can be done using broadcasting but i am getting struck in implementing, can anyone please share the code if possible

 

Below is the script i written in Client controller by googling  which is getting the sys id in the alert

 

$scope.location = {
		displayValue: c.data.loc.short_description,
		value: c.data.loc.sys_id,
		name: 'short_description'
	};
	

	$scope.$on("field.change", function(evt, parms) {
		if (parms.field.name == 'short_description')
			c.data.setLocation = parms.newValue;
			alert(parms.newValue);
			c.server.update().then(function(response) {		
			spUtil.update($scope);
		});
	});
	
	
1 ACCEPTED SOLUTION

Jagadeesh R1
Tera Expert

Hello,

    There is learning plan documentation on this. If both the widgets are in the same page, you can achieve this. Please go through the below link

 

Events and Response

 

Regards,

Jagadeesh

View solution in original post

2 REPLIES 2

Shillu
Kilo Guru

Here is a good example:

https://serviceportal.io/using-events-communicate-widgets/

Jagadeesh R1
Tera Expert

Hello,

    There is learning plan documentation on this. If both the widgets are in the same page, you can achieve this. Please go through the below link

 

Events and Response

 

Regards,

Jagadeesh