Hello!
I am trying to set up a variable and condition in Power Automate to return a string if an image was attached.
This is the list of what survey123 returns for attachments (also global ID which did not fit). Is there any of these that would work for the condition to notice if it is empty?
From there,
- if it is empty, the condition should return a string that says no image was submitted
- if it isn't empty, the condition should return a string that says an image was submitted.
I tried this with feature attachments screenshotAttach, and feature attachments screenshotAttach id. Neither worked, and screenshotAttach id also added an apply to all block, which shouldn't be necessary.
I am trying to find a workaround from this work flow of attaching images with the HTTP block . We do not have the ability to get Power Automate premium. It is fine if there is no image attached, just a message stating whether or not one was submitted.
Thanks to anyone for suggestions!
Solved! Go to Solution.
I mixed up the paths before (opps!). That may have thrown you of.If you swap "is equal to" to "is not equal to", that would fix it. Disregard. I got the order in my post right both times. Dyslexia is a nuisance.
Alternatively, see below.
I just published a test from the web interface and tried remaking the flow - everything appears to work.
I also inspected the JSON for the web submission just to see if anything differed from a desktop submission, and it appears fine. However, I did realize you can probably just reference attachments (triggerOutputs()?['body/feature/attachments']), but that shouldn't really matter.
I have confirmed that the flow below does work and the paths are correct:
Base Power Automate:
With an image attached:
With NO image attached:
Edit: If you'd like to check this for yourself, try this:
I would suggest setting up a variable in Survey123, as that makes life much easier for tasks like this.
The variable in S123 can look different depending on how your image question is set up (either a lone image, a multiline image, or an image in a repeat). Here is how each of those scenarios could look:
This makes your Power Automate flow far more straight forward while avoiding a potentially unnecessary Apply to Each:
Yes, my plan was to set up a variable (as stated in the original post). But what does the condition have to look for from the survey attributes to see if the attachment is empty or not?
The variable is what the yes or no condition will be filled with, but the condition is where the problem starts.
I'd suggest having another look at my original post.
Yes, I understand that, but our variables do not look the same.
so which of the dynamic content will actually return an empty field or not?
What makes sense is using ID or URL or whatever should be empty if no image is submitted. There for, without having "choose a value" filled in should return to empty. Is that not how attachments are submitted? Do you need "is (not) equal to 1" in there for it to run?
I am not building the survey in connect like you are, I am in the web browser and not pushing this out to connect.
This is my list of possible variables from the attachment field in the survey123 WEB form. I have used any of the bottom three, but Power Automate is still always detecting it as an attachment being present, even if there isn't one.
The image submission is just from the standard drop box. If there is anything submitted, PA should return "attachment included", if nothing was submitted, "no attachment included". There is no regard here for how many images.
Okay, this is a very different scenario.
To do this 100% inside of Power Automate while avoiding an Apply to Each, you will want to pick your question's name as the condition and test if that is null.
You should be able to copy-paste this into the Condition (in my example below, my question name is image1)
triggerOutputs()?['body/feature/attachments/screenshotAttach']
I was hopeful, but no, that did not work.
Here is my test submission:
And the email response with "No image was submitted"
Here is the flow:
The submission I tried with this detected that the image submission was null, and there was no image. This is the opposite of what happened before, where every submission had an image. Notice anything that might be wrong?
I mixed up the paths before (opps!). That may have thrown you of.If you swap "is equal to" to "is not equal to", that would fix it. Disregard. I got the order in my post right both times. Dyslexia is a nuisance.
Alternatively, see below.
I just published a test from the web interface and tried remaking the flow - everything appears to work.
I also inspected the JSON for the web submission just to see if anything differed from a desktop submission, and it appears fine. However, I did realize you can probably just reference attachments (triggerOutputs()?['body/feature/attachments']), but that shouldn't really matter.
I have confirmed that the flow below does work and the paths are correct:
Base Power Automate:
With an image attached:
With NO image attached:
Edit: If you'd like to check this for yourself, try this:
Alrighty, not sure what really changed between the last attempt and this one: I really only changed the condition value and sent through some test surveys, but it appeared to work. Thank you!