cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
StretchFredrik
Super User
Super User

Formdata is of type null

Hello,

 

I have a html form im submiting to a Flow in Power Automate, the issue is that even though there is data available in the body the flow cant seem to get it, see below: 

 

StretchFredrik_0-1669369888693.png

StretchFredrik_1-1669369923718.png

 

If anyone has any ideas on how i can solve this please let me know 🙂 Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions

I believe your input for the Apply to each should be the following. Without the ['body'] since you're already using triggerBody.

@{triggerBody()?['$formdata']}

 

If you were using triggerOutputs then it would likely be:

@{triggerOutputs()?['body']?['$formdata']}

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.

View solution in original post

11 REPLIES 11
Expiscornovus
Super User
Super User

Hi @StretchFredrik,

 

What type of expression are you using in the condition?

 

Is that

item()

is equal to hejsan?

 

If that is the case, can you change it to:

item()['value']

is equal to hejsan instead?



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


StretchFredrik
Super User
Super User

Thanks for you reply @Expiscornovus 


Item is set to Item()?['value'] already 😕 

Expiscornovus
Super User
Super User

Hi @StretchFredrik,


Can you add the same expression in a compose before the condition? This way you can troubleshoot what value it is retrieving within the apply to each loop.



Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


grantjenkins
Community Champion
Community Champion

Since it's using the input from your Apply to each it would be in the format:

 

//Change Apply_to_each to match the actual name of your Apply to each

items('Apply_to_each')?['value']

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
StretchFredrik
Super User
Super User

@Expiscornovus  the compose just becomes empty, which I dont understand because it clearly has a value if you look at my output from the trigger.

 

@grantjenkins 

 

Thanks for your reply, tried that too but same result im afraid.

Expiscornovus
Super User
Super User

Hi @StretchFredrik,

 

Can you try this in a compose before the apply to each loop?

triggerBody()['$formdata'][0]['value']


Happy to help out! 🙂

Interested in more #PowerAutomate #SharePointOnline or #PowerVirtualAgents content?
Visit my blog, Subscribe to my YouTube channel or Follow me on Twitter


Can you add a Compose inside your Apply to each and just before your Condition. Then add the Current Item into the Compose and run the flow to look at the output. It should show an object with the key/value properties.

 

If it does, then go back to design view (edit mode) and hover over the Current Item field. This will show you what you need to use followed by ?['value']. This is definitely what you should be using in this instance.

 

grantjenkins_0-1669387887049.png

 

Note that you won't have the name Apply_to_each as you're has a different name.

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
StretchFredrik
Super User
Super User

I'm afraid its still the same because it cant even loop since the $formdata object is null even tho there is data according to the triggeroutput.

 

Right now i loop the $formdata like this:

 

@{triggerBody()?['body']?['$formdata']}

 

and the object looks like this:

 

 "body": {
        "$content-type""application/x-www-form-urlencoded",
        "$content""cGFzc3dvcmQtaW5wdXQ9aGVqc2Fu",
        "$formdata": [
            {
                "key""password-input",
                "value""hejsan"
            }
        ]
    }
}
StretchFredrik
Super User
Super User

@Expiscornovus your expression got me the text, thanks!

 

But im still wondering why it doesnt allow me to loop it because $formdata is null, when obviously there is data since your expression got me it.

 

StretchFredrik_0-1669809107330.png

 

I believe your input for the Apply to each should be the following. Without the ['body'] since you're already using triggerBody.

@{triggerBody()?['$formdata']}

 

If you were using triggerOutputs then it would likely be:

@{triggerOutputs()?['body']?['$formdata']}

 



----------------------------------------------------------------------

If I've answered your question, please mark the post as Solved.

If you like my response, please consider giving it a Thumbs Up.
StretchFredrik
Super User
Super User

You are correct, i feel so stupid 😃

 

Power Automate defaulted into giving me body twice when it applied the loop.

 

Thank you both @grantjenkins @Expiscornovus 

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (5,379)