When dealing with an incident/pothole survey123 report, is there an automated way in rules/webhooks to delete an old record after its surpassed a specific age? I would prefer the webhook path so it can be confirmed but if its a rule that will work.
Solved! Go to Solution.
EDIT: Check out @ChristopherCounsell's post below as he gives some very good info/tips. My post just shows how you'd do this in Power Automate.
Short answer is "yes".
You can use Power Automate and the new Esri connectors (one each for AGO and Enterprise). You can specify a WHERE clause to get the older reports and delete them. The flow itself can run on a schedule:
TIP: When working with Esri's connectors in Power Automate, first search for "Esri" > select your workspace (i.e., AGO or Enterprise) > then locate your desired action
Trying to search for a specific Esri Action (e.g., Get data from feature layer) first will not result in the desired outcome since for whatever reason "Get geometry from feature layer" is the only thing that shows up otherwise.
Webhooks trigger on event/submission, not condition.
I'd advise caution on any delete based practice.
What might be better is to set-up a one-way survey for submissions (users can't see what they add) and then share the data submitted via a Hosted Feature Layer View. You could add a date-based filter to the view. This would effectively remove access to the end users, while retaining the historic records.
Hey Christopher! Thank you for replying, I wanted to build a potential data management tool in that would help eliminate any aged reports kind of like a catch all. My thought was that a webhook or a notebook script could be ran on the feature layer that would prompt a confirmation check via email, the end user (supervisor etc) could read through the aged feature deletion records and confirm is they have all been addressed and then delete. Any thoughts on the best way to do that? I was going to webhook it into an excel to keep historic records but wanted this feature layer to act as a real time open items map.
I'd typically use a web app as a data management tool. You could add infographics, filtering and editing capabilities on a view. Again, could do 'deletes', or just change a field drop-down value from active to resolved, for easy data archiving.
Webhooks are typically more used for event notification or reaction. e.g. new job > notify. Or job resolved > notify and update. I don't know why you'd go through the effort of setting this up for a routine reporting summaries not related to an event. I also think ArcGIS Books can't send emails.
If you're doing this in webhooks you could run a routine event to query the layer, send a list, and then if they respond 'yes', apply a delete request for the list. @abureaux gave an example of that. Again, would recommend not 'deletes' but updates, to avoid any unexpected issues like an accidental 'yes' or bad query.
EDIT: Check out @ChristopherCounsell's post below as he gives some very good info/tips. My post just shows how you'd do this in Power Automate.
Short answer is "yes".
You can use Power Automate and the new Esri connectors (one each for AGO and Enterprise). You can specify a WHERE clause to get the older reports and delete them. The flow itself can run on a schedule:
TIP: When working with Esri's connectors in Power Automate, first search for "Esri" > select your workspace (i.e., AGO or Enterprise) > then locate your desired action
Trying to search for a specific Esri Action (e.g., Get data from feature layer) first will not result in the desired outcome since for whatever reason "Get geometry from feature layer" is the only thing that shows up otherwise.
@ChristopherCounsell @abureaux Thank you both for the help!