Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Replace characters in email subject

(2) ShareShare
ReportReport
Posted on by 37

Hello,

I have to create a flow where at email receive with {} brackets in the subject, they have to be replaced with [] brackets but to not triger when there's {Support}. Let's say the email subject is {Hello there}, the {} brackets have to be replaced with [Hello there] but if it's {Support}, no action should be taken. I'm a newbie and I'm totaly lost and I'll be grateful for any help. Thanks in advance!

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Hello,

    Please tell me if I should post a new topic or something?

    Please help me with the last step. To clarify - now, with this flow, I'm sending an email with subject {whatever} and nothing happens. I'm missing the last step where an email with replaced {} brackets to [] brackets should be sent to a certain mailbox.

    Thank you!

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    While I'm waiting for the answer I decided to test it with a Teams chat instead of email becouse I don't know what to put for a subjekt as you can see in my previous post. The bad thing is it skips the "Set variable" action and the "Post message in a chat or channel" action. I sent an email with subject {Sys}. It doesn't fail but it's just skipped.
    Screenshot_2024_15_07_19_14.png

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Now it have to send an email with the replaced charaters subject to a certain email. What I shold put in the Subject field here:
    Screenshot_2024_15_07_16_15.png

    It should send the fixed email (with the {} replaced) to a certain email.

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Ah, yes, it saves now, thank you a LOT!

  • NathanAlvares24 Profile Picture
    1,673 Super User 2025 Season 1 on at
    Re: Replace characters in email subject

    Hi @Mozo78 !

     

    The "Replace {} with []" action is a "Set variable" action not "Initialize variable" action. Hence the error occurs since you cannot use initialize variables in a loop.

     

    Please use this action:

    NathanAlvares24_0-1721046764418.png

     

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Hello,

    Now I can try and it gives me this error:

     

     

     

     

    Flow save failed with code 'InvalidVariableInitialization' and message 'The variable action 'Replace_{}_with_[]' of type 'InitializeVariable' cannot be nested in an action of type 'Condition'.'.

     

     

     

     

     

    Screenshot_2024_15_07_15_18.png

     

    The condition is this:

     

    123.png

    It gives me this error even with your example:

    Screenshot_2024_15_07_15_23.png

     

    Here's a screenshot of the problematic component:

    Screenshot_2024_15_07_15_27.png

  • Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Replace characters in email subject

    Hey @Mozo78 

    Hope the previous condition will work. When you are available just Try once. Let me know if you face any issues.

     

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

    Thanks,

    Sayan Patra | RPA Developer

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Thank you very much, you're great!

    I'm talking somewhat blindly for my boss is at vacation and I can't try it in the moment, accept my sincere excuses.

    Will it work with my condition I posted earlier?

  • Sayan Profile Picture
    789 Super User 2025 Season 1 on at
    Re: Replace characters in email subject

    Hey @Mozo78 

    Then also this whole solution will work just you need to change the condition.

     

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

    if my suggestion helps you, please gives it a Thumbs up 👍 and Marks as a Solution ✔️. Which motivates to solve more problems.

    Thanks,

    Sayan Patra | RPA Developer

     

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

     

  • Mozo78 Profile Picture
    37 on at
    Re: Replace characters in email subject

    Ah, and I just saw it - the subject will never start with { or ends with }. The brackets will be somewhere in the subject text.

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