<?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 addFeatures overwrites OBJECTID in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-addfeatures-overwrites-objectid/m-p/1073128#M73643</link>
    <description>&lt;P&gt;I'm trying to add new features (socket) via queryFeatures:&lt;BR /&gt;&lt;BR /&gt;My graphic object:&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;{"geometry":{"spatialReference":{"wkid":4326},"x":4.39725,"y":51.23578},"symbol":null,"attributes":{"OBJECTID":244024786,"id":244024786,"courseOverGround":"348.1","fiveMinuteMark":"false","length":"50.0","maxDraught":"8.3","oneMinuteMark":"false","poaCalculatedSpeedInMeterPerSecond":"7.987","poaStationarySinceUtcTime":null,"shipKind":"UNKNOWN","speedOverGroundInMeterPerSecond":"5.6","width":"8.0"},"popupTemplate":null}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add this graphic object to the layers source with:&lt;BR /&gt;&lt;BR /&gt;&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;layer.queryFeatures({
                where: "1=1",
                returnGeometry: true,
                outFields: ["*"]
            }).then((data: any) =&amp;gt; {
                    
                    const edits = { addFeatures: [pointGraphic] } // new graphic see above
                    layer.applyEdits(edits);
                }).catch((e: any) =&amp;gt; {
                    ...
                });&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;But when it's queried. The OBJECT ID is overwritten and it gets ID = 1.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Solution?&lt;/P&gt;</description>
    <pubDate>Mon, 28 Jun 2021 12:32:34 GMT</pubDate>
    <dc:creator>MichaelK1</dc:creator>
    <dc:date>2021-06-28T12:32:34Z</dc:date>
    <item>
      <title>ApplyEdits addFeatures overwrites OBJECTID</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-addfeatures-overwrites-objectid/m-p/1073128#M73643</link>
      <description>&lt;P&gt;I'm trying to add new features (socket) via queryFeatures:&lt;BR /&gt;&lt;BR /&gt;My graphic object:&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;{"geometry":{"spatialReference":{"wkid":4326},"x":4.39725,"y":51.23578},"symbol":null,"attributes":{"OBJECTID":244024786,"id":244024786,"courseOverGround":"348.1","fiveMinuteMark":"false","length":"50.0","maxDraught":"8.3","oneMinuteMark":"false","poaCalculatedSpeedInMeterPerSecond":"7.987","poaStationarySinceUtcTime":null,"shipKind":"UNKNOWN","speedOverGroundInMeterPerSecond":"5.6","width":"8.0"},"popupTemplate":null}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to add this graphic object to the layers source with:&lt;BR /&gt;&lt;BR /&gt;&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;layer.queryFeatures({
                where: "1=1",
                returnGeometry: true,
                outFields: ["*"]
            }).then((data: any) =&amp;gt; {
                    
                    const edits = { addFeatures: [pointGraphic] } // new graphic see above
                    layer.applyEdits(edits);
                }).catch((e: any) =&amp;gt; {
                    ...
                });&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;But when it's queried. The OBJECT ID is overwritten and it gets ID = 1.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Solution?&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 12:32:34 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-addfeatures-overwrites-objectid/m-p/1073128#M73643</guid>
      <dc:creator>MichaelK1</dc:creator>
      <dc:date>2021-06-28T12:32:34Z</dc:date>
    </item>
    <item>
      <title>Re: ApplyEdits addFeatures overwrites OBJECTID</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-addfeatures-overwrites-objectid/m-p/1073229#M73655</link>
      <description>&lt;P&gt;ObjectIds are determined by the FeatureLayer (client-side) or Feature Service. You can't override them. If it's an existing feature, you can use the updateFeatures. If you need it as a reference, from another source, I've seen people add it as a refObjectId field or similar so they can refer back to where the feature originally came from.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Jun 2021 15:31:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/applyedits-addfeatures-overwrites-objectid/m-p/1073229#M73655</guid>
      <dc:creator>ReneRubalcava</dc:creator>
      <dc:date>2021-06-28T15:31:45Z</dc:date>
    </item>
  </channel>
</rss>

