<?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 ignores 3rd delete array in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367#M79708</link>
    <description>&lt;P&gt;In order for the &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#applyedits" target="_self"&gt;applyEdits&lt;/A&gt; operation to successfully process the deletes, the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#objectidfield" target="_self"&gt;objectIdField&lt;/A&gt; must be set.&amp;nbsp; Although I suppose you could manually set it, this ordinarily doesn't take place until the layer has&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#loaded" target="_self"&gt;loaded&lt;/A&gt;.&amp;nbsp; Therefore, I would recommend something like the following change:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
featureLayer.on("load", function() {
	featureLayer.applyEdits(null, null, [toDelete], (adds, updates, deletes) =&amp;gt; {
		resolve(deletes);
	}, err =&amp;gt; {
		console.log(err);
		debugger
		reject(err);
	});
});&lt;/LI-CODE&gt;&lt;P&gt;Waiting for the layer to load before calling applyEdits may also solve the problem you were having in &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/td-p/1242909/" target="_self"&gt;the other thread&lt;/A&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 22 Dec 2022 17:30:05 GMT</pubDate>
    <dc:creator>JoelBennett</dc:creator>
    <dc:date>2022-12-22T17:30:05Z</dc:date>
    <item>
      <title>featureLayer.applyEdits ignores 3rd delete array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243281#M79703</link>
      <description>&lt;DIV&gt;JS API v3&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;docs say the 3rd param is &lt;SPAN&gt;&amp;lt;&lt;/SPAN&gt;&lt;SPAN&gt;&lt;A title="https://developers.arcgis.com/javascript/3/jsapi/graphic-amd.html" href="https://developers.arcgis.com/javascript/3/jsapi/graphic-amd.html" target="_blank" rel="noreferrer noopener"&gt;Graphic[]&lt;/A&gt;&lt;/SPAN&gt;&lt;SPAN&gt;&amp;gt; deletes, and the only specified requirement is "Array of features to delete. Must have valid ObjectId" &lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/DIV&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;    const toDelete = new esriJS.EsriGraphic();
    toDelete.setAttributes({})
    toDelete.attributes.objectid = objectid;
    const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
    featureLayer.applyEdits(null, null, [toDelete],
      (adds, updates, deletes) =&amp;gt; {
        resolve(deletes);
      },
      err =&amp;gt; {
        console.log(err);
        debugger
        reject(err);
      });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;DIV&gt;&lt;SPAN&gt;(my layer's objectIdField is called objectid (all lower case)).&lt;/SPAN&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_1-1671707913605.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59153iA1C2DE76B7BF474D/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_1-1671707913605.png" alt="ViktorSafar_1-1671707913605.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;I can see that the function makes the POST but ignores the [toDelete] parameter that was passed in. What am I doing wrong?&lt;/DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="ViktorSafar_2-1671707969161.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/59155i92BA632F6798EA8C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="ViktorSafar_2-1671707969161.png" alt="ViktorSafar_2-1671707969161.png" /&gt;&lt;/span&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BR /&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;</description>
      <pubDate>Thu, 22 Dec 2022 11:19:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243281#M79703</guid>
      <dc:creator>ViktorSafar</dc:creator>
      <dc:date>2022-12-22T11:19:52Z</dc:date>
    </item>
    <item>
      <title>Re: featureLayer.applyEdits ignores 3rd delete array</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367#M79708</link>
      <description>&lt;P&gt;In order for the &lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#applyedits" target="_self"&gt;applyEdits&lt;/A&gt; operation to successfully process the deletes, the&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#objectidfield" target="_self"&gt;objectIdField&lt;/A&gt; must be set.&amp;nbsp; Although I suppose you could manually set it, this ordinarily doesn't take place until the layer has&amp;nbsp;&lt;A href="https://developers.arcgis.com/javascript/3/jsapi/featurelayer-amd.html#loaded" target="_self"&gt;loaded&lt;/A&gt;.&amp;nbsp; Therefore, I would recommend something like the following change:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayer = new esriJS.FeatureLayer(featureLayerUrl);
featureLayer.on("load", function() {
	featureLayer.applyEdits(null, null, [toDelete], (adds, updates, deletes) =&amp;gt; {
		resolve(deletes);
	}, err =&amp;gt; {
		console.log(err);
		debugger
		reject(err);
	});
});&lt;/LI-CODE&gt;&lt;P&gt;Waiting for the layer to load before calling applyEdits may also solve the problem you were having in &lt;A href="https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-error-after-successful/td-p/1242909/" target="_self"&gt;the other thread&lt;/A&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 22 Dec 2022 17:30:05 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/featurelayer-applyedits-ignores-3rd-delete-array/m-p/1243367#M79708</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2022-12-22T17:30:05Z</dc:date>
    </item>
  </channel>
</rss>

