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 Apps / Writing javascript in ...
Power Apps
Answered

Writing javascript in email body?

(0) ShareShare
ReportReport
Posted on by 18

So, I have finally got my stations in an array variable, and now I want to loop through and print the station names in the body of the email step. In the attached photo you can see the part of the email body I am trying to loop through things. I have not done this before so here is what I am trying

 

@{
                // Dynamically populate station names
                foreach(var stationName in Station Names) {
                    <div style="width: 17%; border-bottom: 2px solid rgb(111, 249, 57); padding-bottom: 7px; text-align: center;">
                        @{stationName}
                    </div>
                }
            }
 

Station Names is the variable that hold the station names, and of course stationName being what should be printing the station names. am I headed in the right direction?

 

Categories:
I have the same question (0)
  • Verified answer
    Anchov Profile Picture
    1,986 on at

    Hi @Bacon1 , Most modern email clients will not allow code execution in the body of an email because of security ( prevents malware from being executed).  Another approach is to dynamically expand (or loop through) the list of station names in either power apps or power automate, generate the html,  then send the email.  This way the email client will only receive static html.  The approach will depend on which tool you are using.  Are you wanting user Power Apps or Power Automate? It is not clear from your original email.

     


    If I have answered your question, please mark your post as Solved.
    If you like my response, please give it a Thumbs Up.

    Cheers!
    Rick Hurt

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…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard