<?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>topic publish a message from widget? in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1084740#M2532</link>
    <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;Can anyone direct me to an example of publishing a message from a widget?&amp;nbsp; I'm looking at the &lt;A href="https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/widgets/message-subscriber" target="_self"&gt;message-subscriber&lt;/A&gt; example but don't see any companion for actually publishing a message to be consumed.&lt;/P&gt;&lt;P&gt;I've seen the &lt;A href="https://developers.arcgis.com/experience-builder/guide/core-concepts/message-action/" target="_self"&gt;help topic&lt;/A&gt; on publishing a message but was hoping for a working example.&amp;nbsp; It's also not clear to me whether custom messages are supported or whether we're limited to the four listed&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;--john&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Sun, 01 Aug 2021 19:45:34 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2021-08-01T19:45:34Z</dc:date>
    <item>
      <title>publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1084740#M2532</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;&lt;P&gt;Can anyone direct me to an example of publishing a message from a widget?&amp;nbsp; I'm looking at the &lt;A href="https://github.com/Esri/arcgis-experience-builder-sdk-resources/tree/master/widgets/message-subscriber" target="_self"&gt;message-subscriber&lt;/A&gt; example but don't see any companion for actually publishing a message to be consumed.&lt;/P&gt;&lt;P&gt;I've seen the &lt;A href="https://developers.arcgis.com/experience-builder/guide/core-concepts/message-action/" target="_self"&gt;help topic&lt;/A&gt; on publishing a message but was hoping for a working example.&amp;nbsp; It's also not clear to me whether custom messages are supported or whether we're limited to the four listed&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;--john&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 01 Aug 2021 19:45:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1084740#M2532</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-01T19:45:34Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1084800#M2535</link>
      <description>&lt;P&gt;John, I had a conversation with Gavin Rehkemper about this during the User Conference.&amp;nbsp; His response:&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"I can make a request to have a sample to do that. Specifically you’re asking about&amp;nbsp;&lt;A href="https://developers.arcgis.com/experience-builder/sample-code/widgets/message-subscriber/" target="_blank" rel="noopener"&gt;https://developers.arcgis.com/experience-builder/sample-code/widgets/message-subscriber/&lt;/A&gt;&amp;nbsp;but that one is only subscribing, not publishing, and you’d like a sample that publishes the message action?"&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/320"&gt;@GavinRehkemper&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you can't wait for Esri to come out with the new sample widget and you haven't seen this video:&lt;/P&gt;&lt;P&gt;&lt;A href="https://www.youtube.com/watch?v=UIqMqnfTlWQ&amp;amp;t=22s" target="_blank" rel="noopener"&gt;https://www.youtube.com/watch?v=UIqMqnfTlWQ&amp;amp;t=22s&lt;/A&gt;&lt;/P&gt;&lt;P&gt;Look at the examples at 37:23.&amp;nbsp; And if you go back to version 1.3 (or before) you can also find what appears to be the source code (though I couldn't get them to work).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="DaveFullerton_0-1627875511041.png" style="width: 999px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/19867i241E2A60B1C70E7C/image-size/large?v=v2&amp;amp;px=999" role="button" title="DaveFullerton_0-1627875511041.png" alt="DaveFullerton_0-1627875511041.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Aug 2021 03:43:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1084800#M2535</guid>
      <dc:creator>DaveFullerton</dc:creator>
      <dc:date>2021-08-02T03:43:32Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085409#M2548</link>
      <description>&lt;P&gt;Thanks for your reply Dave.&amp;nbsp; I went back and watched that 2020 video again and it looks like David's doing what I'm looking for but I couldn't get enough of the source code from the video to make much progress.&lt;/P&gt;&lt;P&gt;I did also find those 1.3 examples you pointed me to.&amp;nbsp; Did Gavin say why those examples weren't included in subsequent releases?&amp;nbsp;&lt;/P&gt;&lt;P&gt;The samples seem to be just using pre-defined messages. I wonder if there is a way to use custom messages or even get a list of the existing messages.&amp;nbsp; The API docs for &lt;A href="https://developers.arcgis.com/experience-builder/api-reference/jimu-core/MessageType" target="_self"&gt;MessageType&lt;/A&gt;&amp;nbsp; enumeration don't seem to include them all.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:33:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085409#M2548</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-03T17:33:56Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085413#M2549</link>
      <description>&lt;P&gt;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/315031"&gt;@DavidHernandez&lt;/a&gt;&amp;nbsp;told me that the communication widgets in the dist folder were not intended to be made public and that they were going to clean things up for version 1.4.&amp;nbsp; Unfortunately, I haven't done much with widget communication yet and don't have any more information.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 17:44:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085413#M2549</guid>
      <dc:creator>DaveFullerton</dc:creator>
      <dc:date>2021-08-03T17:44:30Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085430#M2552</link>
      <description>&lt;P&gt;@Anonymous User&lt;/P&gt;&lt;P&gt;This is what I use to communicate between my Parcel Search widget and My Print widget.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;//pSearch Widget Sender
//import {appActions} from 'jimu-core'
//widgetStatePropChange parameters
//1. the widgets id
//2. the objects name
//3. the object you are passing
this.props.dispatch(appActions.widgetStatePropChange(this.props.id, 'pSearchData', cTextElements));

//Print Widget reciever
//I define a ExtraProps Interface
interface ExtraProps{
  pSearchData: any
}

//I add that interface to my widget class
export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;IMConfig&amp;gt; &amp;amp; ExtraProps, State&amp;gt;{
  static mapExtraStateProps = (state: IMState, ownProps: AllWidgetProps&amp;lt;IMConfig&amp;gt;): ExtraProps =&amp;gt; {
    let wId: string;
    for (const [key, value] of Object.entries(state.widgetsState)) {
      if(value.pSearchData){
        wId = key;
      }
    }
    return {
      pSearchData: state.widgetsState[wId]?.pSearchData
    }
  }
....

//Then in my code I can just call 
this.props.pSearchData&lt;/LI-CODE&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;</description>
      <pubDate>Tue, 03 Aug 2021 18:34:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1085430#M2552</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-08-03T18:34:24Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1086863#M2576</link>
      <description>&lt;P&gt;Thanks for your help Robert!&amp;nbsp; It looks like you're not actually sending a message but sharing widget state as described &lt;A href="https://developers.arcgis.com/experience-builder/guide/widget-communication/" target="_self"&gt;here.&lt;/A&gt;&amp;nbsp; &amp;nbsp;It appears that updates to that shared state are causing the receiving component to re-render and that static method to read through all the Redux-managed state runs with every re-render. Is that also correct?&lt;/P&gt;&lt;P&gt;It looks like there's no documentation on appActions - am I missing something?&lt;/P&gt;&lt;P&gt;Based on your example, I'm successfully updating that widget state from the sender component and displaying that change in the receiver. Listed below is my stripped down receiver component.&lt;/P&gt;&lt;P&gt;Thanks again.&lt;/P&gt;&lt;P&gt;--john&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/** @jsx jsx */
import { AllWidgetProps, jsx, IMState, React, State } from 'jimu-core';
import { IMConfig } from '../config';

interface ExtraProps{
  myMessage: any
}

export default class Widget extends React.PureComponent&amp;lt;AllWidgetProps&amp;lt;IMConfig&amp;gt; &amp;amp; ExtraProps, State&amp;gt;{
  static mapExtraStateProps = (state: IMState, ownProps: AllWidgetProps&amp;lt;IMConfig&amp;gt;): ExtraProps =&amp;gt; {
    let wId: string;
    for (const [key, value] of Object.entries(state.widgetsState)) {
      if(value.myMessage){
        wId = key;
      }
    }
    return {
      myMessage: state.widgetsState[wId]?.myMessage
    }
  }

  render() {
    return (
      &amp;lt;div&amp;gt;
      {this.props.myMessage}
      &amp;lt;/div&amp;gt;
    )
  }
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 13 Aug 2021 20:46:43 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1086863#M2576</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2021-08-13T20:46:43Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1086864#M2577</link>
      <description>&lt;P&gt;I am no expert on this (I merely dabbled in this months ago), and I haven't looked at your guys code that closely, but just in case it helps and you haven't seen it, you might look at this post, John:&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/t5/arcgis-experience-builder-questions/redux-samples/m-p/1082080#M2472" target="_blank"&gt;https://community.esri.com/t5/arcgis-experience-builder-questions/redux-samples/m-p/1082080#M2472&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 07 Aug 2021 16:40:51 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1086864#M2577</guid>
      <dc:creator>DaveFullerton</dc:creator>
      <dc:date>2021-08-07T16:40:51Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1169634#M4294</link>
      <description>&lt;P&gt;I am looking to create a Notifications custom widget, something where other widgets can provide status or results messages to the user. I was looking to the Message Actions approach as it provides the ability for other widgets to broadcast their messages, and this widget would filter and act on such messages with an Alert element added to its UI. However the Message Action approach would require a custom Message Type which the framework/typescript don't appear to allow. The concept of broadcasting messages is appealing as I wouldn't have to hook up (reference the notifications widget in the configuration of) all my other widgets to the Notifications widget, which is what seems to be required in&amp;nbsp;&lt;A href="https://community.esri.com/t5/user/viewprofilepage/user-id/1104" target="_self"&gt;&lt;SPAN class=""&gt;RobertScheitlin__GISP&lt;/SPAN&gt;&lt;/A&gt;'s solution which is based on updating another widgets state.&lt;/P&gt;&lt;P&gt;Is creating custom message types something we can do? If so, how?&lt;/P&gt;&lt;P&gt;Is there another approach that I am missing, that could deliver a notifications widget in an Experience Builder app?&lt;/P&gt;</description>
      <pubDate>Mon, 02 May 2022 02:13:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1169634#M4294</guid>
      <dc:creator>MarkJTurnbull</dc:creator>
      <dc:date>2022-05-02T02:13:55Z</dc:date>
    </item>
    <item>
      <title>Re: publish a message from widget?</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1178924#M4536</link>
      <description>&lt;P&gt;Thank you for this code snippet. If this could be added to the widget development&amp;nbsp;&lt;A href="https://developers.arcgis.com/experience-builder/guide/widget-communication/#21-use-widget-state-to-share-state-between-widgets" target="_self"&gt;guide&lt;/A&gt;, it will be really useful.&lt;/P&gt;</description>
      <pubDate>Wed, 01 Jun 2022 10:05:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/publish-a-message-from-widget/m-p/1178924#M4536</guid>
      <dc:creator>KarthikAditya</dc:creator>
      <dc:date>2022-06-01T10:05:37Z</dc:date>
    </item>
  </channel>
</rss>

