Pass value from Client script to Widget

Eli Guttman
Tera Guru

Hi,

On service portal record producer, i have an onchange client script - i would like to pass a certain value from the client script, to another variable of Macro type, implemented by a widget.

So basically i'm trying to pass a value from the on change client script to that widget.

 

Appreciate any help / advice

1 REPLY 1

Chander Bhusha1
Tera Guru

Hi Elig,

 

You can refer the links below which says the same thing.

In this thread they have said that if you need the variable value in widget then you can directly use it :

In the widget client controller you can use this

$scope.$watch(function () {    
	return $scope.page.g_form.getValue('my_variable');    
}, function (value) {
	//Do stuff with value
}

for more detailed explanation:

https://community.servicenow.com/community?id=community_question&sys_id=604ea73edbca53042e247a9e0f96...

The other links.

https://www.jds.net.au/servicenow-catalog-client-scripts-g_form-clear-values/

https://hi.service-now.com/kb_view.do?sysparm_article=KB0728388

https://community.servicenow.com/community?id=community_question&sys_id=5985c3eddbd8dbc01dcaf3231f96...

 

 

Mark helpful and correct if it helps.

Thanks,

CB