Select to view content in your preferred language

PA Flow Intermittently Working: Condition Error

2543
11
05-12-2026 08:41 AM
AnninaRupe1
Frequent Contributor

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

0 Kudos
11 Replies
abureaux
MVP Frequent Contributor

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

0 Kudos
AnninaRupe1
Frequent Contributor

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?

0 Kudos
abureaux
MVP Frequent Contributor

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?

0 Kudos
AnninaRupe1
Frequent Contributor

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.

0 Kudos
abureaux
MVP Frequent Contributor

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.

abureaux_4-1779376314158.png

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:

  1. I can reliably build my compose action to pull out a specific piece of data. E.g., I want to use "spill1b" in a condition. I would build it as either body('Get data from feature layer')?['data']?[0]?['attributes']?['chem_gen_rpt_lcn'] if I wanted the first item from the array, or item()?['attributes']?['spill1b'] if I was using a Filter array step to get all items where "spill1b" was equal to 1
    abureaux_2-1779375752857.png
  2. Check my outputs/schema to correct an error.

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:

abureaux_3-1779376012713.png

* 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. 

AnninaRupe1
Frequent Contributor

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.

0 Kudos
AnninaRupe1
Frequent Contributor

Alright @abureaux ...

This issue is intermittent. There are still errors in my Condition, and I can't figure out why. Here is my Compose input:

Screenshot 2026-06-03 143309.png

And my Condition: (the Outputs is: outputs('Compose') )

Screenshot 2026-06-03 143524.png

 

 

 

 

 

 

 

But I still get errors and the Flow says it's successful!

Screenshot 2026-06-03 143911.png

 

 

 

 

 

 

Is there anything I can do? I have to go into each run, check if it actually was successful, and manually fix it if it didn't. 

 

0 Kudos
abureaux
MVP Frequent Contributor

Do you have a screenshot of the errors somewhere? Esri connections tend to "fail gracefully". That is, they will fail, dump all the failure data into an "Error" table, then mark the execution as a "Success" because they "successfully failed". If you expend the Esri step though, you will see the "Error" table and get a better idea of what went wrong. 

From these screen shots, everything appears to be correct. The only change I'd personally make is put those other two attributes into their own "Compose" and then reference those Composes in the "Condition". 

Minor notes:

  • You can also use "Variables" instead of "Compose" in most cases. Variables have the added advantage of being easier to find in the popup content (they are always at the top of the list since you can add the "Initialize Variable" step at the top of your flow), and their name shows up on screen instead of just "Outputs".
  • You can rename your steps, so instead of "Compose" it could be "Compose - Fetch Updates Count". Makes things easier to read and find.
0 Kudos
AnninaRupe1
Frequent Contributor

Thanks for the best practices suggestions! Implementing now.

think I have narrowed down part of the problem. I don't think this accounts for all of the errors, but I made one modification at a time to see what the Flow behavior would be, and this is what happens:

The trigger is "When a record is updated in a feature layer," and this is looking at a related table. The next 2 actions look at the same related table: "Fetch updates, changes, or deletions from feature layer" and "Condition."
If the Condition action is true, I "Get data from feature layer" which is the parent feature layer of the related table. I use Advanced parameters to query the parent feature layer by the GlobalID field, that matches the parentrec value from the related table where the change was made. I need to do this because I need to copy the geometry and a couple of attributes and some attributes from the related table to a record in an Enterprise feature layer.

I say all this because the Flow is actually successful when the change is made in the related table. However, the Flow also runs when a change is made in the parent record and not the related table. This is when I see the errors in the Condition action. Is this weird behavior? I would think that if a change was made in the parent record it wouldn't trigger since I reference the related record feature layer as the input parameter.

I also looked for the Error table but couldn't find one. The only thing I could see is the Code View for the Condition and it just listed everything that should happen, not the output code.

0 Kudos