<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>question Catalog Client script - broadcast event to widget in Developer forum</title>
    <link>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206043#M860618</link>
    <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have a record producer that I incorporated in Service portal.&lt;/P&gt;
&lt;P&gt;One of the variables in the record producer is a widget.&lt;/P&gt;
&lt;P&gt;What I am trying to do is communicate between catalog client script and the widget. What I want to achieve is when one of the variables change, I will do some manipulation in the widget controls. For this purpose I want to broadcast an event to the widget, just like you interact between 2 widgets.&lt;/P&gt;
&lt;P&gt;But I can't seem to find a way to do it. There is no apparent way to communicate between the catalog client script and the widget.&lt;/P&gt;
&lt;P&gt;Does anyone know how I can achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 17 May 2018 14:54:50 GMT</pubDate>
    <dc:creator>erantal2000</dc:creator>
    <dc:date>2018-05-17T14:54:50Z</dc:date>
    <item>
      <title>Catalog Client script - broadcast event to widget</title>
      <link>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206043#M860618</link>
      <description>&lt;P&gt;Hello everyone,&lt;/P&gt;
&lt;P&gt;I have a record producer that I incorporated in Service portal.&lt;/P&gt;
&lt;P&gt;One of the variables in the record producer is a widget.&lt;/P&gt;
&lt;P&gt;What I am trying to do is communicate between catalog client script and the widget. What I want to achieve is when one of the variables change, I will do some manipulation in the widget controls. For this purpose I want to broadcast an event to the widget, just like you interact between 2 widgets.&lt;/P&gt;
&lt;P&gt;But I can't seem to find a way to do it. There is no apparent way to communicate between the catalog client script and the widget.&lt;/P&gt;
&lt;P&gt;Does anyone know how I can achieve this?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 17 May 2018 14:54:50 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206043#M860618</guid>
      <dc:creator>erantal2000</dc:creator>
      <dc:date>2018-05-17T14:54:50Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog Client script - broadcast event to widget</title>
      <link>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206044#M860619</link>
      <description>&lt;P&gt;Probably a bit late for you, but this one is actually pretty simple.&lt;/P&gt;
&lt;P&gt;You don't need to broadcast from a client script, you can have a widget react on a variable change using $watch:&lt;/P&gt;
&lt;PRE class="language-javascript"&gt;&lt;CODE&gt;$scope.$watch(function () {    
	return $scope.page.g_form.getValue('my_variable');    
}, function (value) {
	//Do stuff with value
}&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;I don't think it's possible to broadcast from catalog client scripts as $rootscope is not defined, but you should be able to handle any events needed with a $watch in this way, even if it is just by setting a hidden variable which is specifically being watched by your widget.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 11:35:10 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206044#M860619</guid>
      <dc:creator>Thomas Wright</dc:creator>
      <dc:date>2018-08-21T11:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog Client script - broadcast event to widget</title>
      <link>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206045#M860620</link>
      <description>&lt;P&gt;We have a winner.&lt;/P&gt;
&lt;P&gt;Not late at all.&lt;/P&gt;
&lt;P&gt;Amazing.&lt;/P&gt;
&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 21 Aug 2018 12:17:16 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2206045#M860620</guid>
      <dc:creator>erantal2000</dc:creator>
      <dc:date>2018-08-21T12:17:16Z</dc:date>
    </item>
    <item>
      <title>Re: Catalog Client script - broadcast event to widget</title>
      <link>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2641333#M1025708</link>
      <description>&lt;P&gt;Is anyone still following this thread? Im trying to do this in a catalog item widget and the console fills with errors.&lt;/P&gt;&lt;P&gt;js_includes_sp_libs.jsx?v=06-23-2023_1740&amp;amp;lp=Fri_Jul_28_06_14_53_PDT_2023&amp;amp;c=30_878:142 TypeError: Cannot read properties of undefined (reading 'getValue')&lt;/P&gt;</description>
      <pubDate>Fri, 11 Aug 2023 15:20:29 GMT</pubDate>
      <guid>https://www.servicenow.com/community/developer-forum/catalog-client-script-broadcast-event-to-widget/m-p/2641333#M1025708</guid>
      <dc:creator>jasonkist</dc:creator>
      <dc:date>2023-08-11T15:20:29Z</dc:date>
    </item>
  </channel>
</rss>

