Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Using Flows
Answered

Birthday Email to Include Random Images

(0) ShareShare
ReportReport
Posted on by 14

We have created a flow to send birthday emails to employees, its working as expected fetching the data from sharpeoint list. however the HR team wanted random images to be included in the email, in the email body i couldn't see an option to include picking of random images from may be a pool of 5 images each time when it send the email.  

 

i know that we can use JavaScript in html to achieve this, however with msflow JS wont work is what i know. any way that i could achieve this , appreciate the help

  • aakkuummaarr Profile Picture
    46 on at
    Re: Birthday Email to Include Random Images

    Hi @DamoBird365 ,

     

    What is the Concat you have used in Attachment Name please?

  • pradeep_kumar Profile Picture
    42 on at
    Re: Birthday Email to Include Random Images

    Hi

     

    i want to insert image in email body but match numbers of work years and image number and embedded image in email body such as 

     

    teammate years number 1=1(image name) that insert in email body

  • ajdhingr Profile Picture
    Microsoft Employee on at
    Re: Birthday Email to Include Random Images

    @DamoBird365 Thanks for sharing. @sandeepcrush were you able to resolve your issue ?

  • Verified answer
    DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Birthday Email to Include Random Images

    Hey @sandeepcrush 

     

    I've tried it myself.  You could use a list but thought of an even easier way.  You can simply save the images to your document library as 1,2,3,4,5.jpg etc.

     

    DamoBird365_0-1613747993852.png

     

    Then use rand(1,5) in a compose and use the compose string in the ile identifier.

     

    DamoBird365_1-1613748291009.png

     

    For the file identifier, I had to convert / and spaces into unicode hex.

     

    For example 

    %252fShared%2bDocuments%252fGeneral%252f3.jpg

    OR

    %252fShared%2bDocuments%252fGeneral%252f@{outputs('Compose')}.jpg

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

  • sandeepcrush Profile Picture
    14 on at
    Re: Birthday Email to Include Random Images

    Thanks @DamoBird365 , let me try this , do you have any examples of such scenarios?

  • DamoBird365 Profile Picture
    8,942 Microsoft Employee on at
    Re: Birthday Email to Include Random Images

    Hi @sandeepcrush,

     

    if you are confident attaching files to an email, why don't you use the function rand(1,5) to generate a random number from 1 to 5 and using that answer look up an image with column image number 1 to 5 in a sharepoint list?  Or have a condition statement for image 1 to 5 based on the random number.

     

    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
    Cheers,
    Damien


    P.S. take a look at my new blog here

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,026 Most Valuable Professional

Leaderboard

Featured topics

Restore a deleted flow