<?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: featureLayer.applyEdits error after successful server operation in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/m-p/1244742#M79754</link>
    <description>&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;&amp;nbsp; who pointed out that the layer needs to be loaded in order for the applyEdits to work properly&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367/highlight/true#M79708" target="_blank"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367/highlight/true#M79708&lt;/A&gt;&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jan 2023 08:46:05 GMT</pubDate>
    <dc:creator>ViktorSafar</dc:creator>
    <dc:date>2023-01-02T08:46:05Z</dc:date>
    <item>
      <title>featureLayer.applyEdits error after successful server operation</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/m-p/1242909#M79693</link>
      <description>&lt;P&gt;JS API v3.37 (used by the AGE I currently work with) and v3.42 (tried to use latest locally)&lt;/P&gt;&lt;P&gt;I have the following code&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="javascript"&gt;const updatedGraphic = new Graphic()
updatedGraphic.setGeometry(feature.geometry)
updatedGraphic.setAttributes(feature.attributes);

const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
featureLayer.applyEdits(null, [updatedGraphic], null,
  (adds, updates, deletes) =&amp;gt; {
	resolve(updates);
  },
  err =&amp;gt; {
	console.log(err);
	debugger
	reject(err);
  });&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;The call to the API succeeds. I can see in Fiddler the response is as expected and the payload contains the data for the returned array of [adds, updates, deletes]. The feature is also updated on the server.&lt;/P&gt;&lt;P&gt;The error I get originates in the handling JS:&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="javascript"&gt;TypeError: Cannot read properties of undefined (reading 'attributes')
    at Object._editHandler (init.js:2794:52)
    at Object.load (init.js:2730:514)
    at init.js:1006:78
    at e (init.js:105:393)
    at f (init.js:105:182)
    at resolve.callback (init.js:107:10)
    at e (init.js:106:96)
    at f (init.js:105:182)
    at resolve.callback (init.js:107:10)
    at e (init.js:106:96)&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;This is the updatedGraphic object (which is passed as an array to the applyEdits function)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{_constructed: true, geometry: {…}, symbol: undefined, attributes: {…}, _sanitizeNumericValue: ƒ, …}
attributes: {objectid: 14231, ftema: '0', fiskeribruk_type: '2', fiskeredskapskode: '10', objekt_id: null, …}
geometry: {rings: Array(1), _ring: 0, spatialReference: {…}}
infoTemplate: undefined
symbol: undefined
_computedAttributes: null
_computedGeomVersion: null
_computedVersion: null
_constructed: true
_geomVersion: 2
_sanitizeNumericValue: ƒ ()
[[Prototype]]: Object&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have basically the same code to send adds and that works fine&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="javascript"&gt;const newGraphic = new Graphic()
newGraphic.setGeometry(feature.geometry)
newGraphic.setAttributes(feature.attributes);

const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
featureLayer.applyEdits([newGraphic], null, null,
  (adds, updates, deletes) =&amp;gt; {
	resolve(adds);
  },
  err =&amp;gt; {
	console.log(err);
	debugger
	reject(err);
  });&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;</description>
      <pubDate>Wed, 21 Dec 2022 11:53:58 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/m-p/1242909#M79693</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-12-21T11:53:58Z</dc:date>
    </item>
    <item>
      <title>Re: featureLayer.applyEdits error after successful server operation</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/m-p/1244742#M79754</link>
      <description>&lt;P&gt;Thanks to&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/6522"&gt;@JoelBennett&lt;/a&gt;&amp;nbsp; who pointed out that the layer needs to be loaded in order for the applyEdits to work properly&amp;nbsp;&lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367/highlight/true#M79708" target="_blank"&gt;https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367/highlight/true#M79708&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jan 2023 08:46:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/m-p/1244742#M79754</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2023-01-02T08:46:05Z</dc:date>
    </item>
  </channel>
</rss>

