<?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: Getting attribute information for deletedFeature in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1516021#M85232</link>
    <description>&lt;P&gt;I like it, i hacked a different approach but yours essentially creates a lifecycle hook.&lt;/P&gt;</description>
    <pubDate>Wed, 07 Aug 2024 12:14:54 GMT</pubDate>
    <dc:creator>Aeseir</dc:creator>
    <dc:date>2024-08-07T12:14:54Z</dc:date>
    <item>
      <title>Getting attribute information for deletedFeature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1515398#M85209</link>
      <description>&lt;P&gt;We have a feature layer that is created client side e.g.&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const featureLayer = new FeatureLayer({
      title: "Test",
      geometryType: "polygon",
      objectIdField: "ObjectID",
      fields: [
        {
          name: "ObjectID",
          alias: "ObjectID",
          type: "oid"
        },
        {
          name: "id",
          alias: "id",
          type: "guid"
        },
        {
          name: "type",
          alias: "Type",
          type: "string"
        },
        {
          name: "identifiedMarkerID",
          alias: "identifiedMarkerID",
          type: "string"
        },
        {
          name: "recordedDate",
          alias: "recordedDate",
          type: "date"
        }
      ],
      source: [],
      spatialReference: view.spatialReference
    });&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;we then listen to the featurelayer event "edits" and key changes get pushed to server.&lt;/P&gt;&lt;P&gt;problem is that deletedFeatures doesn't show attributes of the said deleted feature, only objectId and globalId, there is no way to access attributes to get the identifiedMarkerID.&lt;/P&gt;&lt;P&gt;we need to be able to record that a feature with identifiedMarkerID that was deleted so if we get audited, we can see that feature was removed and when.&lt;/P&gt;&lt;P&gt;we use the editor widget to handle all the client side feature addition/modification/removal.&lt;/P&gt;&lt;P&gt;Any advice on how to do this.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 10:44:33 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1515398#M85209</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2024-08-06T10:44:33Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute information for deletedFeature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1515654#M85216</link>
      <description>&lt;P&gt;There doesn't seem to be a "natural" way to do this since by the time "edits" has been fired, the feature has been deleted, with no way to get its info from the layer anymore.&amp;nbsp; The widget otherwise provides nothing like a "before-edits" event, which would be helpful in this regard.&amp;nbsp; I see a couple options here though.&lt;/P&gt;&lt;P&gt;First, you could put logic between the "edits" event and your changes getting pushed to the server.&amp;nbsp; In this intermediate step, you could get the feature's data from the server before sending the information to the server about the feature being deleted.&amp;nbsp; This kind of workflow would require an extra server request being added to your overall workflow, and so would be somewhat inefficient, since you'd be sending a network request to get information that existed on your client less than a second ago.&lt;/P&gt;&lt;P&gt;The other option is to add a hack that gets you a reference to the feature before it gets deleted.&amp;nbsp; The best way appears to be by overriding the&amp;nbsp;&lt;A href="https://gar.pacaf.af.mil/jsapi/4.30/sdk/api-reference/esri-widgets-Editor.html#deleteFeatureFromWorkflow" target="_self"&gt;deleteFeatureFromWorkflow&lt;/A&gt; method of the &lt;A href="https://gar.pacaf.af.mil/jsapi/4.30/sdk/api-reference/esri-widgets-Editor.html" target="_self"&gt;Editor&lt;/A&gt; widget, because this method gets called immediately after the final "Delete" button on the widget is clicked, but before the delete operation actually takes place.&amp;nbsp; Therefore, this would be the ideal place to examine the attributes of any features being deleted:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;var editor = new Editor({view:view});

var deleteFeatureFromWorkflow = editor.deleteFeatureFromWorkflow;

editor.deleteFeatureFromWorkflow = function() {
	//This is the array of graphics being deleted
	var graphics = editor.activeWorkflow.data.candidates;

	graphics.forEach(function(graphic) {
		//Do something with the graphic reference here
		console.log("identifiedMarkerID: " + graphic.attributes.identifiedMarkerID;
	});

	return deleteFeatureFromWorkflow.apply(this, arguments);
};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 06 Aug 2024 18:05:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1515654#M85216</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-08-06T18:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute information for deletedFeature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1516021#M85232</link>
      <description>&lt;P&gt;I like it, i hacked a different approach but yours essentially creates a lifecycle hook.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 12:14:54 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1516021#M85232</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2024-08-07T12:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute information for deletedFeature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1516193#M85239</link>
      <description>&lt;P&gt;Nice, good to hear you got it working.&amp;nbsp; The description of the arguments object &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/arguments" target="_self"&gt;here&lt;/A&gt; is definitely better than what I would come up with.&amp;nbsp; By calling &lt;A href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Function/apply" target="_self"&gt;apply&lt;/A&gt; with the arguments object, it ensures the function being called is executed with the same arguments (if any) that were passed to the current function.&lt;/P&gt;</description>
      <pubDate>Wed, 07 Aug 2024 16:24:37 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1516193#M85239</guid>
      <dc:creator>JoelBennett</dc:creator>
      <dc:date>2024-08-07T16:24:37Z</dc:date>
    </item>
    <item>
      <title>Re: Getting attribute information for deletedFeature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1517272#M85266</link>
      <description>&lt;P&gt;Yep sorry i removed my query about arguments, brain wasn't fully operating when I finally got it to work.&lt;/P&gt;</description>
      <pubDate>Fri, 09 Aug 2024 06:26:22 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/getting-attribute-information-for-deletedfeature/m-p/1517272#M85266</guid>
      <dc:creator>Aeseir</dc:creator>
      <dc:date>2024-08-09T06:26:22Z</dc:date>
    </item>
  </channel>
</rss>

