I am working on a Power Automate trigger for a tree planting program, the goal is to have a watering task created when a tree planting task is marked as "COMPLETE"
I have this workflow going using the When a feature layer is updated trigger and then the Fetch Updates action, but the issue I am running into is that if for some reason the completed task is edited AFTER the status is set to COMPLETE, it then triggers again and creates a duplicate watering task because the condition is looking for the COMPLETE from the updated features.
Is there a way to filter down to a specific change in the feature layer? So it will only trigger the create water task if the change to the feature is specifically the status being switched to COMPLETE?
I am following this post because it is a VERY good question. It is so important to be able to pinpoint specific changes to the feature layer. I am curious if Esri or others have any knowledge on doing this.
I had gone through a similar issue here, but my fields were all date fields. Esri support helped identify a workaround in that we would set a condition where if the date of edit was some time later than the date inputted in the field, then the action would not run. For example, if you have the field Tree Planting Task = Complete, and add an additional Completion Date field, you could achieve that similar workflow! However, it's clunky and not as seamless as it would be if the Power Automate trigger could identify changes to a specific field.
could you add an extra field in your feature layer like PlantingFlag (1 or 0, 0 being the default) then when your Planting task is updated to COMPLETE your flow will trigger your watering task IF Planting task=COMPLETE AND PlantingFlag=0 . Then at the end of the flow, you update the PlantingFlag to 1.
That should do it.
Both of these are good ideas, I do have dates in there that I could use to compare as well with a editDate >= plantDate type thing. I am just always hesitant relying on dates for things cause they're always such a pain.
I'll have to try implenting one or both of these and see if it solves that problem, thank you both for your suggestions!
I definitely would be interested in knowing more from Esri about the ability to check for specific updates though or if something like this is going to be the best way to prevent duplicates.
Hi @RobertAnderson3, our discussion in the other forum reminded me of this post. I'm curious to hear what workaround you ended up using for the Status field?
I added a field that gets flagged when a record is successfully processed after being marked complete, so nothing too fancy but it gets the job done. So if the record is flagged it doesn't get processed again even if the record was updated again (because the status isn't getting changed after, just like, pictures being attached or such). Not necessarily a perfect system but it seems to be working well.
We also ended up moving this to a Python script with one of my colleagues giving us a bit more room for flexibility.
Hey @RobertAnderson3 thanks for explaining! What do you mean by the field getting flagged? How did the ArcGIS Power Automate trigger know not to process it again? Also, interesting to hear about the transition to Python. Do you have any resources on where to start with that? For example, what packages you had to utilize to be able to fetch updates and send emails like Power Automate would? Thank you again!
Basically just having a field that when the record is processed, the field would be updated to be a 1 instead of null, so a condition statement would check for 'if not 1' type thing.
Unfortunately on the Python side I don't really have a good starting point, one of my colleagues took over that project as I switched jobs recently. I don't believe at this point it's sending emails, it's being set to run at intervals during the day to check for updates though, I believe just using the "last edited date" field.