<?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: Save graphics to feature layer and update attribute value ? in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632978#M59093</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;After adding below line I was getting error "&amp;nbsp;Cannot set property 'JOBNO' of undefined"&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;graphic&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;attributes&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"JOBNO"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;]&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; newAttribute&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I Created new object then add attributes to object and set to graphic. Below code worked for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/CODE&gt;
var SaveAttribute = new Object();
SaveAttribute.JOBNO= newAttribute;
graphic.attributes = SaveAttribute;
freeHLayer.applyEdits([graphic], null, null).then(function (adds, updates, deletes) {
 console.log('success', adds);
 }, function (err) {
 console.log(err);
 });
&lt;CODE&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sun, 12 Dec 2021 02:56:06 GMT</pubDate>
    <dc:creator>MayurDodiya</dc:creator>
    <dc:date>2021-12-12T02:56:06Z</dc:date>
    <item>
      <title>Save graphics to feature layer and update attribute value ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632976#M59091</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am saving graphics in feature service and I would like to add/update Attribute values to&amp;nbsp;feature was just added&lt;/P&gt;&lt;P&gt;Below is the code I am able to Save graphics to Feature layer Service.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;function createfreehandline (graphic)&lt;BR /&gt; {&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;var freeHLayer = this.map.getLayer('freeHLayer'); // Layer added in map Feature Service layer&lt;/P&gt;&lt;P&gt;freeHLayer.applyEdits([graphic], null, null).then(function (adds, updates, deletes) {&lt;BR /&gt;console.log('success', adds);&lt;/P&gt;&lt;P&gt;}, function (err) {&lt;BR /&gt; console.log(err);&lt;BR /&gt; });&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;For Example, with above code new feature with ObjectId added, now I want to update attribute value in Field name "JOBNO"&amp;nbsp;&lt;/P&gt;&lt;P&gt;How can I update the attribute value of feature that was just added ?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Apr 2019 12:12:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632976#M59091</guid>
      <dc:creator>MayurDodiya</dc:creator>
      <dc:date>2019-04-21T12:12:44Z</dc:date>
    </item>
    <item>
      <title>Re: Save graphics to feature layer and update attribute value ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632977#M59092</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Before you call applyEdits, change the attribute of the graphic to the value &lt;EM&gt;newAttribute&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;graphic&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;attributes&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;&lt;SPAN class="string token"&gt;"JOBNO"&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; newAttribute&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
freeHLayer&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;applyEdits&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;graphic&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; &lt;SPAN class="keyword token"&gt;null&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;.&lt;/SPAN&gt;&lt;SPAN class="token function"&gt;then&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;function&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;adds&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; updates&lt;SPAN class="punctuation token"&gt;,&lt;/SPAN&gt; deletes&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;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:56:03 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632977#M59092</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-12T02:56:03Z</dc:date>
    </item>
    <item>
      <title>Re: Save graphics to feature layer and update attribute value ?</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632978#M59093</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;After adding below line I was getting error "&amp;nbsp;Cannot set property 'JOBNO' of undefined"&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;graphic&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;.&lt;/SPAN&gt;attributes&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;[&lt;/SPAN&gt;&lt;SPAN class="" style="color: #669900; border: 0px; font-weight: inherit;"&gt;"JOBNO"&lt;/SPAN&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;]&lt;/SPAN&gt; &lt;SPAN class="" style="color: #a67f59; background: rgba(255, 255, 255, 0.5); border: 0px; font-weight: inherit;"&gt;=&lt;/SPAN&gt; newAttribute&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;So, I Created new object then add attributes to object and set to graphic. Below code worked for me&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;CODE&gt;&lt;CODE&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/CODE&gt;
var SaveAttribute = new Object();
SaveAttribute.JOBNO= newAttribute;
graphic.attributes = SaveAttribute;
freeHLayer.applyEdits([graphic], null, null).then(function (adds, updates, deletes) {
 console.log('success', adds);
 }, function (err) {
 console.log(err);
 });
&lt;CODE&gt;&lt;SPAN class="" style="color: #999999; border: 0px; font-weight: inherit;"&gt;
&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 12 Dec 2021 02:56:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/save-graphics-to-feature-layer-and-update/m-p/632978#M59093</guid>
      <dc:creator>MayurDodiya</dc:creator>
      <dc:date>2021-12-12T02:56:06Z</dc:date>
    </item>
  </channel>
</rss>

