<?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 Re: How to set a layer name while adding a new layer in Web AppBuilder Custom Widgets Questions</title>
    <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825874#M7847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel Turmel&lt;/P&gt;&lt;P&gt;Senior Consultant&lt;/P&gt;&lt;P&gt;CGI&lt;/P&gt;&lt;P&gt;Email: michel.turmel@cgi.com&amp;lt;mailto:michel.turmel@cgi.com&amp;gt;&lt;/P&gt;&lt;P&gt;Phone: (306) 761-4000 Ext: 1354384&lt;/P&gt;&lt;P&gt;1900 Albert Street&lt;/P&gt;&lt;P&gt;Regina, Saskatchewan&lt;/P&gt;&lt;P&gt;S4P 4K8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Sep 2020 16:41:10 GMT</pubDate>
    <dc:creator>MichelTurmel</dc:creator>
    <dc:date>2020-09-29T16:41:10Z</dc:date>
    <item>
      <title>How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825870#M7843</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I am in the process of creating my first custom 2 D widget and I can dynamically add a layer on the map but when I use the standard Layer List widget I see that the name of the layer I added to the map is&amp;nbsp; the name of the Map Service that I have used. Is there a way to set the name of the new layer that will be displayed when I use the&amp;nbsp;&lt;SPAN&gt;standard Layer List widget?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;Here is my environment:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Portal for ArcGIS version 10.6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;- Web AppBuilder Developer Edition 2.6&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;- ArcGIS JavaScript API 3.33&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 28 Sep 2020 19:43:16 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825870#M7843</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-09-28T19:43:16Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825871#M7844</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp;I set several layer properties in my widgets.&lt;/P&gt;&lt;P&gt;layer._titleForLegend = layer.title = layer.name = 'blah';&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:31:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825871#M7844</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2020-09-29T12:31:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825872#M7845</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Good morning Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for the reply, is there a sample widget url that you could send me?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Am I right to assume that I will be able to use “layer._titleForLegend = layer.title = layer.name&amp;lt;https://urldefense.proofpoint.com/v2/url?u=http-3A__layer.name&amp;amp;d=DwQCaQ&amp;amp;c=H50I6Bh8SW87d_bXfZP_8g&amp;amp;r=k3rHcdYwBizPCV7b7qgyUp_gjpgw6vSQ0uK1EqfctxM&amp;amp;m=4sZH_igkBdNWXpHFicvptdY2VRbC-kg3mtYXdyRTM3A&amp;amp;s=snZ27qhuj0u1lZj_txlk_UasN0p53vCRwThw9h-A5nQ&amp;amp;e=&amp;gt; = 'blah';” only as part of event “layers-add-result” after the map.addLayers(); is completed?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel Turmel&lt;/P&gt;&lt;P&gt;Senior Consultant&lt;/P&gt;&lt;P&gt;CGI&lt;/P&gt;&lt;P&gt;Email: michel.turmel@cgi.com&amp;lt;mailto:michel.turmel@cgi.com&amp;gt;&lt;/P&gt;&lt;P&gt;Phone: (306) 761-4000 Ext: 1354384&lt;/P&gt;&lt;P&gt;1900 Albert Street&lt;/P&gt;&lt;P&gt;Regina, Saskatchewan&lt;/P&gt;&lt;P&gt;S4P 4K8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:59:29 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825872#M7845</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-09-29T15:59:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825873#M7846</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Michel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; No you do not wait for the layer to be added before you apply those properties. After you use the layer constructor you apply those properties before the layer is added to the map.&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;var&lt;/SPAN&gt; myfl &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;new&lt;/SPAN&gt; &lt;SPAN class="token class-name"&gt;FeatureLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"your url"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
myfl_titleForLegend &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; myfl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;title &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; myfl&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;name &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="string token"&gt;'blah'&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="keyword token"&gt;this&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;map&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;addLayer&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;myfl&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;You can find this property ("_titleForLegend") in the otb AddData widget and in my eSearch Widget.&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.esri.com/docs/DOC-1731-enhanced-search-widget-version-213-092519" target="_blank"&gt;https://community.esri.com/docs/DOC-1731-enhanced-search-widget-version-213-092519&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 09:55:56 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825873#M7846</guid>
      <dc:creator>RobertScheitlin__GISP</dc:creator>
      <dc:date>2021-12-12T09:55:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825874#M7847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works great!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel Turmel&lt;/P&gt;&lt;P&gt;Senior Consultant&lt;/P&gt;&lt;P&gt;CGI&lt;/P&gt;&lt;P&gt;Email: michel.turmel@cgi.com&amp;lt;mailto:michel.turmel@cgi.com&amp;gt;&lt;/P&gt;&lt;P&gt;Phone: (306) 761-4000 Ext: 1354384&lt;/P&gt;&lt;P&gt;1900 Albert Street&lt;/P&gt;&lt;P&gt;Regina, Saskatchewan&lt;/P&gt;&lt;P&gt;S4P 4K8&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 16:41:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825874#M7847</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-09-29T16:41:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825875#M7848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey Robert,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm running into this issue as well but I want just the default title to be the layer name of the Feature Layer instead of the Map Service.&amp;nbsp; Any ideas? I want to use the name in the Layer 1 Name:&amp;nbsp;&lt;A class="link-titled" href="https://carto.nationalmap.gov/arcgis/rest/services/govunits/MapServer/1" title="https://carto.nationalmap.gov/arcgis/rest/services/govunits/MapServer/1"&gt;Layer: Incorporated Place labels (ID: 1)&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Oct 2020 21:12:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825875#M7848</guid>
      <dc:creator>JohnLucotch2</dc:creator>
      <dc:date>2020-10-15T21:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825876#M7849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello John,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You will need to set the layer name in a variable and then apply it to the layer you are about to add:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var template = new esri.InfoTemplate();&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;var &lt;STRONG&gt;newLayerName&lt;/STRONG&gt; = "new layer name"&lt;/P&gt;&lt;P&gt;var newLayerSearch = "....."&lt;/P&gt;&lt;P&gt;var newLayerURL = "https://..........";&lt;/P&gt;&lt;P&gt;var newLayerFeatureLayer = new esri.layers.FeatureLayer(newLayerURL, {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;id: newLayerName,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;definitionExpression: newLayerSearch&lt;/P&gt;&lt;P&gt;});&lt;/P&gt;&lt;P&gt;// the following line will provide the layer name displayed on the Layer List:&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;newLayerFeatureLayer._titleForLegend=newLayerFeatureLayer.title=newLayerFeatureLayer.name=&lt;STRONG&gt;newLayerName&lt;/STRONG&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;map.addLayers([&lt;SPAN&gt;newLayerFeatureLayer]);&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Michel Turmel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Oct 2020 21:45:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825876#M7849</guid>
      <dc:creator>MichelTurmel</dc:creator>
      <dc:date>2020-10-15T21:45:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to set a layer name while adding a new layer</title>
      <link>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825877#M7850</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks but not what I was hoping for. &amp;nbsp;I don’t want to use the name variable. &amp;nbsp;I want to use the default layer name similar to the add data widget.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 15 Oct 2020 21:55:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/web-appbuilder-custom-widgets-questions/how-to-set-a-layer-name-while-adding-a-new-layer/m-p/825877#M7850</guid>
      <dc:creator>JohnLucotch2</dc:creator>
      <dc:date>2020-10-15T21:55:47Z</dc:date>
    </item>
  </channel>
</rss>

