<?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 applyedits with setAttributes in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75784#M6891</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, first time using applyedits so Im a little confused on the process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a graphic that id like to add to a feature layer. so I have the graphic and I am able to add just the graphic to the feature layer. but the user needs to add the attributes themselves otherwise everything is pretty much null. I am trying to set attributes before the apply edits that way a lot of the attributes can be set automatically, but I get an error that says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;{code: 500, message: "Unable to complete operation.", details: Array[0], log: undefined, httpCode: 500…}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; map.graphics.on("click", function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("click graphic");
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; evt.graphic.setAttributes( {"OBJECTID":2312,"PARCELID":"1231233","STATUS":"RETIRED"});//test values&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FeatureLayr.applyEdits([evt.graphic],null,null,null,errCallback);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&lt;/SPAN&gt;


&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I remove line 3 above (setAttributes) a dialog comes up to enter the attributes, but if I have the set attributes code I get that error. not sure I understand what the error is saying.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 10 Dec 2021 22:56:05 GMT</pubDate>
    <dc:creator>IbrahimHussein</dc:creator>
    <dc:date>2021-12-10T22:56:05Z</dc:date>
    <item>
      <title>applyedits with setAttributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75784#M6891</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hey guys, first time using applyedits so Im a little confused on the process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a graphic that id like to add to a feature layer. so I have the graphic and I am able to add just the graphic to the feature layer. but the user needs to add the attributes themselves otherwise everything is pretty much null. I am trying to set attributes before the apply edits that way a lot of the attributes can be set automatically, but I get an error that says&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;{code: 500, message: "Unable to complete operation.", details: Array[0], log: undefined, httpCode: 500…}&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Code:&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&amp;nbsp; map.graphics.on("click", function(evt) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; console.log("click graphic");
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; evt.graphic.setAttributes( {"OBJECTID":2312,"PARCELID":"1231233","STATUS":"RETIRED"});//test values&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FeatureLayr.applyEdits([evt.graphic],null,null,null,errCallback);&lt;/SPAN&gt;
&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&lt;/SPAN&gt;


&lt;SPAN style="font-size: 9pt; line-height: 12pt;"&gt;});&amp;nbsp;&amp;nbsp; });&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I remove line 3 above (setAttributes) a dialog comes up to enter the attributes, but if I have the set attributes code I get that error. not sure I understand what the error is saying.&amp;nbsp; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:56:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75784#M6891</guid>
      <dc:creator>IbrahimHussein</dc:creator>
      <dc:date>2021-12-10T22:56:05Z</dc:date>
    </item>
    <item>
      <title>Re: applyedits with setAttributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75785#M6892</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;In my application, I'm setting the attributes of the feature with this syntax before I use the applyEdits method. The fields of the feature are "Priority", "Management", and "Criteria"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;feature.attributes.Priority = priorityValue;
feature.attributes.Management = managementValue;
feature.attributes.Criteria = criteriaValue;&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 10 Dec 2021 22:56:07 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75785#M6892</guid>
      <dc:creator>KenBuja</dc:creator>
      <dc:date>2021-12-10T22:56:07Z</dc:date>
    </item>
    <item>
      <title>Re: applyedits with setAttributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75786#M6893</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, you're getting me on the right track. But the current graphic only has these fields.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;attributes:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Object&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; OBJECTID: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; created_date: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; created_user: ""&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; last_edited_date: &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; last_edited_user: ""&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I noticed when I do setAttributes, they all get removed and the ones I set are the ones that are there. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Feb 2015 15:05:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75786#M6893</guid>
      <dc:creator>IbrahimHussein</dc:creator>
      <dc:date>2015-02-20T15:05:50Z</dc:date>
    </item>
    <item>
      <title>Re: applyedits with setAttributes</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75787#M6894</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ok, figured it out. it was a scope issue. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;placing the setAttributes after the applyedits fixed it, which makes sense. Thanks Ken, figured it out with your tip. &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 20 Feb 2015 15:14:30 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-with-setattributes/m-p/75787#M6894</guid>
      <dc:creator>IbrahimHussein</dc:creator>
      <dc:date>2015-02-20T15:14:30Z</dc:date>
    </item>
  </channel>
</rss>

