web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Iterate through fields...
Power Automate
Unanswered

Iterate through fields of a form

(0) ShareShare
ReportReport
Posted on by

Hi all,

 

I'm trying to sanitize the fields from my form before they can be sent in an email. This allows me to block certain injections such as html, javascript, etc.

 

I want to sanitize all of my fields returned. I have a general idea of how to sanitize them, my problem is more on going through all my fields that my form has. I can't put the Body returned by the form in an apply to each like I tried to do, because Body is an Object. I would need to translate what that object contains in an array that I can iterate through.

 

asdf.PNG

 

Any ideas ? Thanks

Categories:
I have the same question (0)
  • Gopala_Krishna Profile Picture
    1,495 on at

    @Anonymous 

    You can make use of the create array function in power automate to achieve this, you can pass all the object structure as a parameter inside the create array function and it convert it into an array. Later you can use this array to perform further operations.

     

    Gopala_Krishna_0-1621354207379.png

     

    For example you can initialise an array variable in the start and then you can set the array value using the expression, you can then make use of the array variable to loop through the items.

     

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

    If the information shared helps you, please consider giving a thumbs up 👍and mark solution as resolved

  • Community Power Platform Member Profile Picture
    on at

    @Gopala_Krishna 

     

    Thank you so much for the help. I was able to create an array based on the Object thanks to you.

     

    I had an idea on how to do the sanitising but something seems to be wrong. Maybe if you can help me with that it would be very helpful also.

     

    I created an array variable of my object called "RawInputs", and I also created another array variable called "InvalidChars" that contains the characters that I typically want to replace. The third variable I created is called "Temp", and is just used to make the replacing happen.

     

    I make an "Apply to each" on my "InvalidChars" variable, and then I set my "Temp" variable to something like this :

     

    replace(variables('RawInputs'), item(), '')

     

    The problem with this is that it creates an error saying that the first parameter of replace has to be a string. Do you have any idea on how I could make this happen ?

     

    Thanks again!

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 398 Super User 2025 Season 2

#2
David_MA Profile Picture

David_MA 331 Super User 2025 Season 2

#3
Expiscornovus Profile Picture

Expiscornovus 203 Most Valuable Professional

Last 30 days Overall leaderboard