<?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: Edit DataSource Records Programmatically in ArcGIS Experience Builder Questions</title>
    <link>https://community.esri.com/t5/arcgis-experience-builder-questions/edit-datasource-records-programmatically/m-p/1408893#M12054</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3137"&gt;@RyanCoodey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P data-unlink="true"&gt;The data source in ExB doesn't implement edit-related methods, including the `updateRecord`. You can do it using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_self"&gt;applyEdits method&lt;/A&gt; of the ArcGIS Maps SDK for JavaScript.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const jsAPIFeatureLayer = await featureLayerDs.createJSAPILayerByDataSource()
const result = await jsAPIFeatureLayer.applyEdits(edits, options)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Fri, 12 Apr 2024 06:06:26 GMT</pubDate>
    <dc:creator>YueyangLi</dc:creator>
    <dc:date>2024-04-12T06:06:26Z</dc:date>
    <item>
      <title>Edit DataSource Records Programmatically</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/edit-datasource-records-programmatically/m-p/1366626#M10112</link>
      <description>&lt;P&gt;I am able to access and query a DataSource just fine from a custom widget. But I need to insert/update some records programmatically as well. When I try to use ds.updateRecord() I get an error "Editing source is not ready yet". Any ideas how to make it ready?&lt;/P&gt;&lt;P&gt;I confirmed the DataSource is coming from the Feature Service and the capabilities say&amp;nbsp;"Query,Create,Update,Uploads,Editing"&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;        //Get update data source
        const ds = DataSourceManager.getInstance().getDataSource(props.useDataSources[1].dataSourceId) as FeatureLayerDataSource
        //Get record to update
        ds.query({
          where: "UserId='" + props.user.username + "'"
        }).then((result) =&amp;gt; {
          if (result.records &amp;amp;&amp;amp; result.records.length &amp;gt; 0)
          {
            //Get record data and change
            const record = result.records[0]
            const dat = record.getData()
            dat.TypeCode = "New Value"
            //Process update --ERROR HERE: Editing source is not ready yet
            ds.updateRecord(dat).then((success) =&amp;gt; {
            })
          }
        })&lt;/LI-CODE&gt;&lt;P&gt;Examples seem to show creating an editor widget. I am just wanting to call the service on the backend and do some edits though. In this case for a non-spatial table even. Worst case I suppose I could use the JS API or call the service endpoint directly, but assuming I am missing something with ExB objects.&lt;/P&gt;&lt;P&gt;Thanks for any help!&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jan 2024 23:36:31 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/edit-datasource-records-programmatically/m-p/1366626#M10112</guid>
      <dc:creator>RyanCoodey</dc:creator>
      <dc:date>2024-01-04T23:36:31Z</dc:date>
    </item>
    <item>
      <title>Re: Edit DataSource Records Programmatically</title>
      <link>https://community.esri.com/t5/arcgis-experience-builder-questions/edit-datasource-records-programmatically/m-p/1408893#M12054</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.esri.com/t5/user/viewprofilepage/user-id/3137"&gt;@RyanCoodey&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P data-unlink="true"&gt;The data source in ExB doesn't implement edit-related methods, including the `updateRecord`. You can do it using the &lt;A href="https://developers.arcgis.com/javascript/latest/api-reference/esri-layers-FeatureLayer.html#applyEdits" target="_self"&gt;applyEdits method&lt;/A&gt; of the ArcGIS Maps SDK for JavaScript.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;const jsAPIFeatureLayer = await featureLayerDs.createJSAPILayerByDataSource()
const result = await jsAPIFeatureLayer.applyEdits(edits, options)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope it can help you.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Apr 2024 06:06:26 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-experience-builder-questions/edit-datasource-records-programmatically/m-p/1408893#M12054</guid>
      <dc:creator>YueyangLi</dc:creator>
      <dc:date>2024-04-12T06:06:26Z</dc:date>
    </item>
  </channel>
</rss>

