Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

extract subject and date from inside email body and make a calendar event

(0) ShareShare
ReportReport
Posted on by 13

Hi,

 

We have a reservation system in Service Now to reserve a seat in our office.

After we reserve a seat we will receive from "test@service-now.com" an email containing this info:

"

Your reservation was confirmed. Here are the details:

  • Reservation number: TEST0049887
  • Subject: Reservation for 27 D
  • Start date and time: 30-05-2024 08:00 Europe/Amsterdam
  • End date and time: 30-05-2024 20:00 Europe/Amsterdam

"

 

My goal is to have an all day event created in my Outlook calendar on 30-05-2024 having the event subject "Reservation for 27 D".

  • Verified answer
    abouchaalaBAIT Profile Picture
    930 Super User 2025 Season 1 on at
    Re: extract subject and date from inside email body and make a calendar event

    Use this expression for the date

    split(split(split(<YourText>,decodeUriComponent('%0A'))[4],': ')[1],' ')[0]

     

    Expression for the Subject 

    split(split(<YourText>,decodeUriComponent('%0A'))[3],': ')[1]

     

     

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

    If I have answered your question, please mark your post as Solved. ‌‌‌‌

    If you like my response, please give it a Thumbs Up. ‌‌

    You can accept more than one post as a solution.

  • Silvananghel Profile Picture
    13 on at
    Re: extract subject and date from inside email body and make a calendar event

    Thanks again for your help. Can you describe also how I can extract the date ? I need just the date, not the start hour or the end hour.

  • Verified answer
    abouchaalaBAIT Profile Picture
    930 Super User 2025 Season 1 on at
    Re: extract subject and date from inside email body and make a calendar event

    Hello @Silvananghel  No problem, here is a detailed step by step solution :

    Assuming the email body of you email is this exact text : 

     

    Your reservation was confirmed. Here are the details:

     

    Reservation number: TEST0049887
    Subject: Reservation for 27 D
    Start date and time: 30-05-2024 08:00 Europe/Amsterdam
    End date and time: 30-05-2024 20:00 Europe/Amsterdam

     


    What we are looking for is the value Reservation for 27 D which is in the 4th lign, second position after ": "

    Use this expression in a Compose action in order to get in 


    split(split(<YourText>,decodeUriComponent('%0A'))[3],': ')[1]


    1-   Split your email body with  decodeUriComponent('%0A') which represent a new lign
    2-   [3] Get the 4th lign 
    3-   Split again with ": "
    4-   [1] get the second position

     

    abouchaalaBAIT_0-1707822252817.png

     

    abouchaalaBAIT_1-1707822261992.png

     


    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. ‌‌‌‌
    If you like my response, please give it a Thumbs Up. ‌‌
    You can accept more than one post as a solution.

  • Silvananghel Profile Picture
    13 on at
    Re: extract subject and date from inside email body and make a calendar event

    Hi,

    Thank you for the answer. However I am a novice in Power automate. Before writing here, I tried the Copilot feature to help me with this flow, however with no success. So, it will be helpful if you can provide all the steps. Please note that I do not need to extract the line that include "reservation number", but the line that include reservation "subject".

  • Verified answer
    abouchaalaBAIT Profile Picture
    930 Super User 2025 Season 1 on at
    Re: extract subject and date from inside email body and make a calendar event

    Hello  Here is a step by step actions in order to achieve this : 

    1- Split to get each lign

    2- Split to your values

    @{split(outputs('Compose-_txt'),decodeUriComponent('%0A'))}
    
    @{split(items('Apply_to_each'),':')}

    abouchaalaBAIT_0-1707750000682.png

    @Silvananghel

     

    ----------------------------------------------------------
    If I have answered your question, please mark your post as Solved. 🆗✔️
    If you like my response, please give it a Thumbs Up. 👍
    You can accept more than one post as a solution.

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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 566 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 516 Super User 2025 Season 1

#3
stampcoin Profile Picture

stampcoin 492