<?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: Setting a retention policy? in ArcGIS Survey123 Questions</title>
    <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492105#M57386</link>
    <description>&lt;P&gt;I don't believe this is easily possible.&amp;nbsp; The REST API for querying attachments doesn't seem to provide any kind of timestamp indicating when the upload occurred.&amp;nbsp; It's possible to extract EXIF data but that probably wouldn't work for you in every case, since it might not accurately reflect upload date, or it could be missing.&lt;/P&gt;&lt;P&gt;A &lt;EM&gt;very&lt;/EM&gt; brute force approach would be something like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create a feature service with a single table that has two columns, attachment_id and date_identified.&lt;/LI&gt;&lt;LI&gt;Run a nightly process that reads all of the attachments against a layer.&amp;nbsp; If new attachments are found, insert a row into the table with the attachment's ID and the current date.&amp;nbsp; If an old attachment has been deleted, remove it from the table.&lt;/LI&gt;&lt;LI&gt;As a follow-up to that process, run a query to see if any of the table's records have a date greater than three years old and trigger your logic based on that - auto-delete, notify by email, etc.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This doesn't really work for any records that have already been sitting around for years though, the three-year clock would start running when you make this live.&lt;/P&gt;&lt;P&gt;Edit to add - With a three-year clock you could even run this thing weekly or monthly and it'd probably be good enough.&lt;/P&gt;</description>
    <pubDate>Thu, 13 Jun 2024 20:37:10 GMT</pubDate>
    <dc:creator>MobiusSnake</dc:creator>
    <dc:date>2024-06-13T20:37:10Z</dc:date>
    <item>
      <title>Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492001#M57384</link>
      <description>&lt;P&gt;Hello! I would like to set up a system to track how long specific files (generally PDFs or images) have been uploaded, and when they hit 3 years, trigger a notification that the file should be deleted. Is there a best practice for this sort of thing? I know I can track when a survey was submitted, however part of my workflow involves editing surveys via embedding in a dashboard.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any suggestions would be greatly appreciated!&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 18:45:59 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492001#M57384</guid>
      <dc:creator>RHammers</dc:creator>
      <dc:date>2024-06-13T18:45:59Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492105#M57386</link>
      <description>&lt;P&gt;I don't believe this is easily possible.&amp;nbsp; The REST API for querying attachments doesn't seem to provide any kind of timestamp indicating when the upload occurred.&amp;nbsp; It's possible to extract EXIF data but that probably wouldn't work for you in every case, since it might not accurately reflect upload date, or it could be missing.&lt;/P&gt;&lt;P&gt;A &lt;EM&gt;very&lt;/EM&gt; brute force approach would be something like this:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Create a feature service with a single table that has two columns, attachment_id and date_identified.&lt;/LI&gt;&lt;LI&gt;Run a nightly process that reads all of the attachments against a layer.&amp;nbsp; If new attachments are found, insert a row into the table with the attachment's ID and the current date.&amp;nbsp; If an old attachment has been deleted, remove it from the table.&lt;/LI&gt;&lt;LI&gt;As a follow-up to that process, run a query to see if any of the table's records have a date greater than three years old and trigger your logic based on that - auto-delete, notify by email, etc.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;This doesn't really work for any records that have already been sitting around for years though, the three-year clock would start running when you make this live.&lt;/P&gt;&lt;P&gt;Edit to add - With a three-year clock you could even run this thing weekly or monthly and it'd probably be good enough.&lt;/P&gt;</description>
      <pubDate>Thu, 13 Jun 2024 20:37:10 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492105#M57386</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2024-06-13T20:37:10Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492764#M57394</link>
      <description>&lt;P&gt;This actually should be possible with the new Power Automate connectors. You can periodically pull data from a Feature Layer, look at it's Created Date, and then delete if that is &amp;gt;3 years old.&lt;/P&gt;&lt;P&gt;For the ParseJSON step, you can use this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;{
    "data": [
      {
        "attributes": {
          "last_edited_date": null,
          "created_date": null,
          "objectid": null
        }
      }
    ]
  }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"created_date" is saved in UNIX time, so needs to be converted:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_0-1718376206279.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107081i02A561ED1405536C/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_0-1718376206279.png" alt="abureaux_0-1718376206279.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;addseconds('1970-1-1', Div(items('Apply_to_each_-_Loop_through_data')?['attributes']?['created_date'],1000) , 'yyyy-MM-dd')&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Date difference expression is also annoying, so here:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;int(first(split(dateDifference(outputs('Compose_-_Create_Date'),variables('dateToday')),'.')))&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;U&gt;&lt;STRONG&gt;Here is a quick and dirty example:&lt;/STRONG&gt;&lt;/U&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="abureaux_2-1718377185683.png" style="width: 400px;"&gt;&lt;img src="https://community.esri.com/t5/image/serverpage/image-id/107086iD2D401BC80BF5804/image-size/medium?v=v2&amp;amp;px=400" role="button" title="abureaux_2-1718377185683.png" alt="abureaux_2-1718377185683.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;EDIT: In case it wasn't obvious, the "Outputs" used in the Condition are the outputs of "Compose - Date Difference". The output should be in days, so 3 years = 1095 days.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 15:02:24 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492764#M57394</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-06-14T15:02:24Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492777#M57395</link>
      <description>&lt;P&gt;It sounds like the attachment age may not necessarily align with the feature's editor tracking, since they're editing the survey after submission via a webform, and attachments don't have their own editor tracking.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 15:24:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492777#M57395</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2024-06-14T15:24:28Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492781#M57397</link>
      <description>&lt;P&gt;I thought of this in my head, but didn't say it out loud.&lt;/P&gt;&lt;P&gt;While I am using "create date" in the flow, I also exposed "modified date" since that probably makes more sense to use. I would assume (aka, &lt;EM&gt;hope&lt;/EM&gt;) Esri links the modified date to any changes to a feature layer (e.g., attachments). Should be easy enough to test for RHammers, I just don't have a data set that would work.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 15:29:13 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492781#M57397</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-06-14T15:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492818#M57399</link>
      <description>&lt;P&gt;Unfortunately modifying attachments doesn't set the modified date (I've run into this before trying to do change detection).&amp;nbsp; I think attachment adds/deletes are treated like an edit to a related table rather than an edit on the table itself.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 16:55:25 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492818#M57399</guid>
      <dc:creator>MobiusSnake</dc:creator>
      <dc:date>2024-06-14T16:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: Setting a retention policy?</title>
      <link>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492835#M57402</link>
      <description>&lt;P&gt;I just tried uploading an attachment and compared the "last_edited_date" value. They were identical before and after. And this timestamp should include up to the millisecond I believe. Well... that's disappointing.&lt;/P&gt;&lt;P&gt;Ya, attachments are painfully lacking of support for this type of operation. The easiest thing to do would be to delete the entire entry after 3 years from "last modified date". But that assumes you aren't uploading attachments at a later date... very frustrating.&lt;/P&gt;</description>
      <pubDate>Fri, 14 Jun 2024 17:27:01 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-survey123-questions/setting-a-retention-policy/m-p/1492835#M57402</guid>
      <dc:creator>abureaux</dc:creator>
      <dc:date>2024-06-14T17:27:01Z</dc:date>
    </item>
  </channel>
</rss>

