<?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: onEditsComplete to update another field in the feature in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479664#M44594</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You probably don't need 'dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);', instead just use the inline callback function in the applyEdits call.&amp;nbsp; Also, you're connecting this event many times, once for each map click; not sure if that is making a difference.&amp;nbsp; I would also hitch the inline calls to make sure you have the proper context.&amp;nbsp; Also, you need to get the updated feature from the feature layer again as the one currently in memory might not have the correct ObjectID that was assigned on the server.&amp;nbsp; This last step might not be necessary depending on what you need to do; in your case the ObjectID is provided by the FeatureEditResult object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
featureLayerEdit.applyEdits([graphic], null, null, dojo.hitch(this, function(addResults){
&amp;nbsp; if(addResult.success){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.objectIds = [addResult.objectId];
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.queryFeatures(query, dojo.hitch(this, function(featureSet){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(featureSet.features.length &amp;gt; 0){&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newFeature = featureSet.features[0];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newFeature.attributes["6"] = addResult.objectId + "_SOMEOTHERVAL";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.applyEdits(null, [newFeature], null);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }));&amp;nbsp; 
&amp;nbsp; }
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not tested this, but it should be close to what you need.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 21:10:45 GMT</pubDate>
    <dc:creator>JohnGrayson</dc:creator>
    <dc:date>2021-12-11T21:10:45Z</dc:date>
    <item>
      <title>onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479659#M44589</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;I have been trying to add an entry to a featureLayer and in want to get a callback from this so I can update another field in it. below is my code&lt;/SPAN&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;
clkListenerAddFeature = dojo.connect(map, "onClick", function (evt)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; //alert("inside the click function");
&amp;nbsp;&amp;nbsp;&amp;nbsp; var point = evt.mapPoint;

&amp;nbsp;&amp;nbsp;&amp;nbsp; var attributes = {};
&amp;nbsp;&amp;nbsp;&amp;nbsp; attributes["1"] = "CLOSED";
&amp;nbsp;&amp;nbsp;&amp;nbsp; attributes["2"] = "DENIED"; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; attributes["3"] = "0";
&amp;nbsp;&amp;nbsp;&amp;nbsp; attributes["4"] = "1";
&amp;nbsp;&amp;nbsp;&amp;nbsp; attributes["5"] = userLoginId;

&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = new esri.Graphic(point, null, attributes);
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.applyEdits([graphic], null, null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);

&amp;nbsp;&amp;nbsp;&amp;nbsp; if (clkListenerAddFeature) dojo.disconnect(clkListenerAddFeature);
&amp;nbsp;&amp;nbsp;&amp;nbsp; refresh_map();
&amp;nbsp;&amp;nbsp;&amp;nbsp; reset_map(map);

});

function addResultsComplete(addResults)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (addResults.length &amp;gt; 0) {
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var graphic = featureLayerEdit.graphics[featureLayerEdit.graphics.length - 1];

&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; graphic.attributes["6"] = graphic.attributes["OBJECTID"];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.applyEdits(null, [graphic], null);
&amp;nbsp;&amp;nbsp;&amp;nbsp; }

}
&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;SPAN&gt;but I keep hitting this error &lt;/SPAN&gt;&lt;PRE class="plain" name="code"&gt;TypeError: Unable to get value of the property 'getCellsInExtent': object is null or undefined&lt;/PRE&gt;&lt;DIV style="display:none;"&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;anyone has any ideas?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 27 Dec 2012 00:08:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479659#M44589</guid>
      <dc:creator>jonathanlee1</dc:creator>
      <dc:date>2012-12-27T00:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479660#M44590</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You can try to put the statement below outside of the Onclick event on map:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp; dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Also, is "getCellsInExtent" a function in your application?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 28 Dec 2012 17:54:47 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479660#M44590</guid>
      <dc:creator>RuiShen</dc:creator>
      <dc:date>2012-12-28T17:54:47Z</dc:date>
    </item>
    <item>
      <title>Re: onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479661#M44591</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;in the code you supplied, what are you accomplishing by calling applyEdits a second time?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Dec 2012 15:47:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479661#M44591</guid>
      <dc:creator>JohnGravois</dc:creator>
      <dc:date>2012-12-31T15:47:44Z</dc:date>
    </item>
    <item>
      <title>Re: onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479662#M44592</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BLOCKQUOTE class="jive-quote"&gt;in the code you supplied, what are you accomplishing by calling applyEdits a second time?&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am trying to get the objectId that was generated when I first create the feature and update it to another attribute but concatenating another substring behind the objectId.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;P.S: getCellsInExtent isn't a function of mine. this is to answer the reply above. thanks&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 02 Jan 2013 23:06:02 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479662#M44592</guid>
      <dc:creator>jonathanlee1</dc:creator>
      <dc:date>2013-01-02T23:06:02Z</dc:date>
    </item>
    <item>
      <title>Re: onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479663#M44593</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;this is a kinda rough update to one of our published &lt;/SPAN&gt;&lt;A href="http://help.arcgis.com/en/webapi/javascript/arcgis/help/jssamples/ed_feature_creation.html"&gt;samples&lt;/A&gt;&lt;SPAN&gt;, but i didnt have any trouble passing the objectid to another field using your logic.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://jsfiddle.net/jagravois/5pCWn/2/"&gt;http://jsfiddle.net/jagravois/5pCWn/2/&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;maybe you need to try using the draw toolbar?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 03 Jan 2013 23:28:44 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479663#M44593</guid>
      <dc:creator>JohnGravois</dc:creator>
      <dc:date>2013-01-03T23:28:44Z</dc:date>
    </item>
    <item>
      <title>Re: onEditsComplete to update another field in the feature</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479664#M44594</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;You probably don't need 'dojo.connect(featureLayerEdit, "onEditsComplete", addResultsComplete);', instead just use the inline callback function in the applyEdits call.&amp;nbsp; Also, you're connecting this event many times, once for each map click; not sure if that is making a difference.&amp;nbsp; I would also hitch the inline calls to make sure you have the proper context.&amp;nbsp; Also, you need to get the updated feature from the feature layer again as the one currently in memory might not have the correct ObjectID that was assigned on the server.&amp;nbsp; This last step might not be necessary depending on what you need to do; in your case the ObjectID is provided by the FeatureEditResult object.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;
featureLayerEdit.applyEdits([graphic], null, null, dojo.hitch(this, function(addResults){
&amp;nbsp; if(addResult.success){
&amp;nbsp;&amp;nbsp;&amp;nbsp; var query = new esri.tasks.Query();
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.objectIds = [addResult.objectId];
&amp;nbsp;&amp;nbsp;&amp;nbsp; query.outFields = ["*"];&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.queryFeatures(query, dojo.hitch(this, function(featureSet){
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if(featureSet.features.length &amp;gt; 0){&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; var newFeature = featureSet.features[0];
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; newFeature.attributes["6"] = addResult.objectId + "_SOMEOTHERVAL";
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayerEdit.applyEdits(null, [newFeature], null);
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }
&amp;nbsp;&amp;nbsp;&amp;nbsp; }));&amp;nbsp; 
&amp;nbsp; }
});
&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have not tested this, but it should be close to what you need.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 21:10:45 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/oneditscomplete-to-update-another-field-in-the/m-p/479664#M44594</guid>
      <dc:creator>JohnGrayson</dc:creator>
      <dc:date>2021-12-11T21:10:45Z</dc:date>
    </item>
  </channel>
</rss>

