<?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 Popuptemplate set field value dynamically JS API 4.X in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-set-field-value-dynamically-js-api-4/m-p/1112316#M75120</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to set new field and value dynamically in popup. I'm watching popup's select feature property and set dynamic field in template and value to graphics attributes.&lt;/P&gt;&lt;P&gt;Popup is showing field name but value is empty.&lt;/P&gt;&lt;P&gt;Here is my sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; fl= new FeatureLayer({
                url: serviceBaseUrl + "/FeatureServer/0",
                popupTemplate: {
                    title: "{name}",
                    outFields: ["*"],
                    lastEditInfoEnabled: false,                    
                    content: [
                        {
                            type: "fields",
                            fieldInfos: [
                                {
                                    fieldName: "defaultfield",
                                    label: 'DefaultField'
                                }
                            ]
                        }]
                }
            });

  view.popup.watch("selectedFeature", (graphic) =&amp;gt; {
                if (graphic) { 
                    const graphicTemplate = graphic.getEffectivePopupTemplate();

                    let fieldInfo = new FieldInfo({
                        fieldName: 'dynamicfield',
                        label: 'Dynamic Field'
                    });

                    graphic.setAttribute('dynamicfield', 'Dynamic Value');
                    graphicTemplate.content[0].fieldInfos.push(fieldInfo); 
                }
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to set dynamic values into popup? Any help would be appreciated.&lt;/P&gt;&lt;P&gt;-Prashant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 29 Oct 2021 03:52:40 GMT</pubDate>
    <dc:creator>PrashantKirpan</dc:creator>
    <dc:date>2021-10-29T03:52:40Z</dc:date>
    <item>
      <title>Popuptemplate set field value dynamically JS API 4.X</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-set-field-value-dynamically-js-api-4/m-p/1112316#M75120</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I want to set new field and value dynamically in popup. I'm watching popup's select feature property and set dynamic field in template and value to graphics attributes.&lt;/P&gt;&lt;P&gt;Popup is showing field name but value is empty.&lt;/P&gt;&lt;P&gt;Here is my sample code:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt; fl= new FeatureLayer({
                url: serviceBaseUrl + "/FeatureServer/0",
                popupTemplate: {
                    title: "{name}",
                    outFields: ["*"],
                    lastEditInfoEnabled: false,                    
                    content: [
                        {
                            type: "fields",
                            fieldInfos: [
                                {
                                    fieldName: "defaultfield",
                                    label: 'DefaultField'
                                }
                            ]
                        }]
                }
            });

  view.popup.watch("selectedFeature", (graphic) =&amp;gt; {
                if (graphic) { 
                    const graphicTemplate = graphic.getEffectivePopupTemplate();

                    let fieldInfo = new FieldInfo({
                        fieldName: 'dynamicfield',
                        label: 'Dynamic Field'
                    });

                    graphic.setAttribute('dynamicfield', 'Dynamic Value');
                    graphicTemplate.content[0].fieldInfos.push(fieldInfo); 
                }
            });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;How to set dynamic values into popup? Any help would be appreciated.&lt;/P&gt;&lt;P&gt;-Prashant&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 29 Oct 2021 03:52:40 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/popuptemplate-set-field-value-dynamically-js-api-4/m-p/1112316#M75120</guid>
      <dc:creator>PrashantKirpan</dc:creator>
      <dc:date>2021-10-29T03:52:40Z</dc:date>
    </item>
  </channel>
</rss>

