<?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: Feature service not executing DB triggers in ArcGIS JavaScript Maps SDK Questions</title>
    <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467172#M43305</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Came across something very similar in the below situation and thought I'd share in case of use to future reader.&lt;/P&gt;&lt;P&gt;Mobile solution using Collector and Survey123:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Users starts with Inspection sites in Collector (sites table) and from site pop up opens Survey123 survey for that site with custom url passing details from sites attributes (e.g. previous meter reading at site) into survey123 fields (survey table).&lt;/P&gt;&lt;P&gt;Survey has attachments (feature service attachments true) and db trigger on the survey table that executes when survey submitted. Trigger updates values in sites table e.g. site inspection status, last inspected date, previous meter reading values etc.&lt;/P&gt;&lt;P&gt;What I found was if the feature service had attachments then I needed to execute the trigger on update not insert. Executing it on insert resulted in the trigger firing before attributes in survey table were available to be populated into sites table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the survey table does not have attachments then executing the db trigger on insert works just fine.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2018 22:14:38 GMT</pubDate>
    <dc:creator>Anonymous User</dc:creator>
    <dc:date>2018-12-11T22:14:38Z</dc:date>
    <item>
      <title>Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467168#M43301</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on ArcGIS 10.4.2 in Windows.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have published a feature service to our ArcGIS Server and then added the service to our Portal from a feature class that has Editor Tracking and attachments enabled. In the database I created a sequence called TreeNumber, which I increment with a trigger on the table (feature class) after insert. It is seperate from the ObjectID.&lt;/P&gt;&lt;P&gt;If I add a feature in ArcMap, everything is fine - the attachment works and the TreeNumber is assigned and saved.&lt;/P&gt;&lt;P&gt;If I add a feature using JSON, talking directly to the REST endpoint, TreeNumber is assigned and saved. (I haven't worked out how&amp;nbsp; to add an attachment through the REST endpoint.)&lt;/P&gt;&lt;P&gt;If I add a feature in a Webmap, the attachment works but the TreeNumber is NULL after saving.&lt;/P&gt;&lt;P&gt;If I add a feature in a WebApp (built in WebApp Builder), the attachment works in IE but not in Chrome or Firefox. In all of them the TreeNumber remains NULL.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Portal uses https and a web adaptor and is on the same server as the ArcGIS server.&lt;/P&gt;&lt;P&gt;The data is in a SQL Server 2012 Enterprise Geodatabase on a server separate from the ArcGIS server.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can anyone help me with this?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Hanlie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Feb 2017 13:18:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467168#M43301</guid>
      <dc:creator>HanliePretorius</dc:creator>
      <dc:date>2017-02-07T13:18:32Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467169#M43302</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have found the answer about the attachments in this blog:&lt;BR /&gt;&lt;SPAN style="font-size: 11.0pt; color: #1f497d;"&gt;&lt;A href="https://blogs.esri.com/esri/supportcenter/2016/09/20/announcement-errors-encountered-in-arcgis-for-server-and-portal-for-arcgis-web-apps-after-certain-browser-updates/"&gt;https://blogs.esri.com/esri/supportcenter/2016/09/20/announcement-errors-encountered-in-arcgis-for-server-and-portal-for-arcgis-web-apps-after-certain-browser-updates/&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;After installing the patch, the attachment upload now works in Chrome.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The TreeNumber created by the database trigger is only visible once the editing is disabled and the map view is refreshed so that the feature service is requeried.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Feb 2017 07:56:14 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467169#M43302</guid>
      <dc:creator>HanliePretorius</dc:creator>
      <dc:date>2017-02-08T07:56:14Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467170#M43303</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;"&lt;SPAN style="background-color: #ffffff;"&gt;The TreeNumber created by the database trigger is only visible once the editing is disabled and the map view is refreshed so that the feature service is requeried."&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff;"&gt;Hello, I'm experiencing a similar issue. &amp;nbsp;Can you please give me more detail about&amp;nbsp;you statement above? &amp;nbsp;I don't&amp;nbsp;understand.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 23 May 2017 23:17:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467170#M43303</guid>
      <dc:creator>jonathanrobinson</dc:creator>
      <dc:date>2017-05-23T23:17:13Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467171#M43304</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jonathan,&lt;/P&gt;&lt;P&gt;Incrementing an ID field (TreeNumber) automatically from a feature service is problematic because of the way the REST service communicates with the database - it goes back and forth several times, possibly because ArcGIS first &lt;STRONG&gt;creates&lt;/STRONG&gt; the feature with an ObjectID and a Shape and then &lt;STRONG&gt;updates&lt;/STRONG&gt; this record with attributes. In the front end it all looks like one process, but in the background it's two. I have actually abandoned that idea and now generate TreeNumber values only in the desktop.&lt;/P&gt;&lt;P&gt;If you still want to try to auto increment an id field using a feature service, just make sure you refresh everything after you have saved before you decide if it worked or not. So, close the edit tool and zoom in and out, then you should see the changes. That was what I meant by the statement you highlighted.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;Hanlie&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 24 May 2017 06:17:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467171#M43304</guid>
      <dc:creator>HanliePretorius</dc:creator>
      <dc:date>2017-05-24T06:17:59Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467172#M43305</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Came across something very similar in the below situation and thought I'd share in case of use to future reader.&lt;/P&gt;&lt;P&gt;Mobile solution using Collector and Survey123:&amp;nbsp;&lt;/P&gt;&lt;P&gt;Users starts with Inspection sites in Collector (sites table) and from site pop up opens Survey123 survey for that site with custom url passing details from sites attributes (e.g. previous meter reading at site) into survey123 fields (survey table).&lt;/P&gt;&lt;P&gt;Survey has attachments (feature service attachments true) and db trigger on the survey table that executes when survey submitted. Trigger updates values in sites table e.g. site inspection status, last inspected date, previous meter reading values etc.&lt;/P&gt;&lt;P&gt;What I found was if the feature service had attachments then I needed to execute the trigger on update not insert. Executing it on insert resulted in the trigger firing before attributes in survey table were available to be populated into sites table.&amp;nbsp;&lt;/P&gt;&lt;P&gt;If the survey table does not have attachments then executing the db trigger on insert works just fine.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2018 22:14:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467172#M43305</guid>
      <dc:creator>Anonymous User</dc:creator>
      <dc:date>2018-12-11T22:14:38Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467173#M43306</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the information - looks like a very useful workflow.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2018-12-12 0:15 GMT+02:00, Michael Fletcher &amp;lt;geonet@esri.com&amp;gt;:&lt;/P&gt;&lt;BLOCKQUOTE level="1"&gt;&lt;P&gt;Michael Fletcher&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;replied to the discussion&lt;/P&gt;&lt;P&gt;"Re: Feature service not executing DB triggers"&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;To view the discussion, visit:&lt;/P&gt;&lt;P&gt;https://community.esri.com/message/818908-re-feature-service-not-executing-db-triggers?commentID=818908&amp;amp;et=watches.email.thread#comment-818908&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 12 Dec 2018 06:18:00 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467173#M43306</guid>
      <dc:creator>HanliePretorius</dc:creator>
      <dc:date>2018-12-12T06:18:00Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467174#M43307</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This seems to be the solution.&amp;nbsp;Make sure your trigger is firing on updates and inserts as opposed to just inserts.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;CREATE OR REPLACE TRIGGER&amp;nbsp;Trigger_Name&amp;nbsp;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;BEFORE INSERT OR UPDATE ON "Table_Name"&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;FOR EACH ROW&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;BEGIN&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; IF :NEW.ID IS NULL THEN&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; :NEW.ID :=&amp;nbsp; :NEW.OBJECTID;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; END IF;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;END;&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Apr 2019 15:41:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467174#M43307</guid>
      <dc:creator>Adam_Commeford</dc:creator>
      <dc:date>2019-04-09T15:41:24Z</dc:date>
    </item>
    <item>
      <title>Re: Feature service not executing DB triggers</title>
      <link>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467175#M43308</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks, this worked for me but changes are only visible after creating, saving, updating and saving.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 10 Apr 2019 11:58:50 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-javascript-maps-sdk-questions/feature-service-not-executing-db-triggers/m-p/467175#M43308</guid>
      <dc:creator>HanliePretorius</dc:creator>
      <dc:date>2019-04-10T11:58:50Z</dc:date>
    </item>
  </channel>
</rss>

