All,
I have a Flow that is supposed to copy geometry and attributes from an ArcGIS Online hosted feature class parent record and attributes from a related record to an Enterprise hosted feature class. It is triggered by changing an attribute in the related table. After the record is copied, I have added a step to the Flow to populate a field in the original related table as '1.' This is used in a condition to prevent duplicate copies if the original geometry or attributes are edited in the future.
The problem is sometimes the Flow works. Other times Power Automate says "Your flow ran successfully" but it doesn't actually finish; it gets to the Condition step and spins. In the Run results it shows that there is an error, but "The expression contains dynamic functions, variables or parameters that cannot be resolved in the debugger."
The Power Automate team suggested I try adding another condition to check if the returned array is not empty. However, I've tried several and it still doesn't work. See the attachment. The team is currently working on a release and can't get away to help and suggested I post here since I need immediate assistance.
The function I entered into the window is: empty(outputs('Fetch_updates,_changes,_or_deletions_from_feature_layer')?['body/items'])
Sometimes this function doesn't have an error associated with it (the screenshot shows an exclamation point, but some of my trials don't result in the exclamation point), but the others still do.
Any suggestions? This is really affecting my workflow and will affect it even more because my Tool will see increased use in the near future!
Annina
This is your array: outputs('Fetch_updates,_changes,_or_deletions_from_feature_layer')?['body/items']
Then use length: length(outputs('Fetch_updates,_changes,_or_deletions_from_feature_layer')?['body/items'])
If you return 0, it's empty. If it returns >0, it has items.
Personally, for my sanity, I would toss everything used for the Condition into Composes just before the Condition so their contents could be easily checked. Then, use those Composes in the Condition.
Thanks for the input. I did try the length version prior to this, but I tried again just in case. That part seems to work, but the other conditions don't. See the screenshot.
I looked for the Composes action, but all I could find was Compose, and I have no idea how to enter a condition into the inputs there. See the other screenshot.
Suggestions?
Sorry for the confusion. Yes, "Compose" is exactly what I was talking about. All Compose does is allow you to dump content. You can put pretty much anything you want into it. It can be used in a bunch of different scenarios such as clearly displaying output, being used in an Apply to each were "Set Variable" would not work, etc.
In my case, I'd put my formula into the Compose, then reference the Compose's Outputs in the Condition. This allows you to confirm that the value you expect to see was retrieved, and confirms that the Condition is in fact comparing values that make sense. Power Automate doesn't explicitly show you the Condition's inputs, just true or false.
For the other two (the Attributes), are you able to give some more detail? Like, the full address being used. Or ideally the JSON of whatever their source is?
I put the two attributes in separate Compose actions and entered those as the inputs in the Condition. Still have the same issue. Then I thought I understood incorrectly, so I updated the Compose action to the length(output(....)), but that threw an error in the Condition.
I'm referencing two separate attributes from the For each. I want to create a record in an Enterprise feature layer, but only when the conditions are met (first condition: Attributes/polytoHDP is changed to 'Yes' and if the Attributes/pacopied is not 1, meaning this action hasn't been done previously). I don't know if I can get the source JSON (how do I find this?) but can't share any data as this is being used with private information.
It really depends on how you are getting your data. But most actions have an "Inputs" and "Outputs" section. The "Outputs" is what you would be looking for because those Outputs are what you use in your subsequent steps. Normally, there is a "Show raw outputs" button that makes this extra easy.
For example, in the flow I am currently building, I am using Esri's Enterprise "Get data from feature layer" action. If I view the outputs, I get this (note that I deleted everything out of "headers" as well as some personal information from the "created_user" fields):
{
"statusCode": 200,
"headers": {},
"body": {
"data": [
{
"attributes": {
"chem_gen_rpt_lcn": "Chemical storage room located within the north central portion of the building. ",
"created_user": "",
"chem_gen_man_n": null,
"chem_gen_spills_yn": "no",
"chem_gen_drain_y": null,
"parentrowid": "{}",
"globalid": "{}",
"chem_gen_drain_yn": "no",
"chem_gen_spills_y": null,
"chem_gen_rpt_name": "Chromic acid",
"last_edited_user": "",
"chem_gen_rpt_con": "good",
"chem_gen_man_yn": "yes",
"spill1b": 0,
"last_edited_date": 1779291698703,
"created_date": 1779291698703,
"objectid": 1
}
},
{
"attributes": {
"chem_gen_rpt_lcn": "Chemical storage room within north central portion of the Site Building. ",
"created_user": "",
"chem_gen_man_n": null,
"chem_gen_spills_yn": "no",
"chem_gen_drain_y": null,
"parentrowid": "{FF85B410-21C0-4926-931E-26E36D5BF867}",
"globalid": "{B3E401F1-C71F-4354-B715-0E9D37808D89}",
"chem_gen_drain_yn": "no",
"chem_gen_spills_y": null,
"chem_gen_rpt_name": "Nitric acid",
"last_edited_user": "",
"chem_gen_rpt_con": "good",
"chem_gen_man_yn": "yes",
"spill1b": 0,
"last_edited_date": 1779291698703,
"created_date": 1779291698703,
"objectid": 2
}
}
]
}
}With this schema, I can now do two things:
In your case, you are getting inconsistent results from your workflows. That points to the issue most likely being the wrong information being extracted, or the correct information being extracted but used incorrectly. Thus, putting your specific outputs into a Compose action will allow you to verify on the fly what went wrong. E.g., If you expect an attribute to be "Yes" but it is in fact "yes", that would be a problem.
Again, this is the workflow I am currently building. You can better see this logic in action:
* Also, small disclaimer. I tend to not use the "New designer" personally. I have found that it has (or maybe had?) many bugs which have caused me many problems in the past. I also find the classic designer is considerably better at using available screen realisatate, and many of my flows can get quite long.
What a great explanation--thank you.
I go back and forth between the classic and new designers; some things are only visible in one or the other (or, more likely, I just haven't found the locations!).
Thanks for the explanation on the JSON; I've seen the inputs and outputs but didn't know that was what you were referring to. For the flows that fail, I don't get any JSON telling me what record (and attributes) failed. Most of the time it's just referencing the layer ID and not much else.
I logged in to get you some examples of JSON from the failed Condition, but the outputs are different than they were yesterday. So, I decided to trigger the flow from the end-user Tool rather than doing a test or re-submitting an old one. I did this twice: once for a flow that would meet the conditions and once for a flow that would fail the conditions. It seemed to have run correctly.
I'm going to keep an eye on this but I expect there's still something wrong, I just got lucky today. I'm wondering if I'm not extracting/using the data extracted correctly like you said, maybe with regards to the related table aspect. I will keep you posted.