cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vstar19
Helper V
Helper V

using the replace and lower in the same Flow expression.

Hello,
I have the below formula which replaces a value of text.
replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'olddomain','newdomain')
This works fine.
However, the issue is that I need the front of the email to be lower case. So if the user types in FIRSTNAME.LASTNAME@olddomain.com , the replace does not convert the front of the string to lower case.
 
Can someone suggest how I can use the tolower function in combination with the replace function to ensure all the text returned is lowercase?
 
Thanks.
 
 
2 ACCEPTED SOLUTIONS

Accepted Solutions
tom_riha
Super User
Super User

Hello @Vstar19 ,

just put the current expression inside toLower(..)

toLower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'olddomain','newdomain'))


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

Then a bit different order, make the whole response lowercase first, and then replace.

replace(toLower(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02']),'olddomain','newdomain')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
tom_riha
Super User
Super User

Hello @Vstar19 ,

just put the current expression inside toLower(..)

toLower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'olddomain','newdomain'))


[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]
Vstar19
Helper V
Helper V

Hello. Thanks for your response. 

 

This works to an extent. I just tested it. 

 

THe problem I have now is that is a user enters there email as firstname.lastname@OLDDOMAIN.COM , the flow expression you gave is ignored, because it is looking for olddomain in lowercase.

Is there anyway we can specify in the flow to say if the olddomain is written as CAPS, then make it lowercase. 

 

OR is there a way to add multiple conditions to our query something like 

toLower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'olddomain','newdomain', 'OLDDOMAIN,newdomain)) 

Essentially, what I am looking for is the ability to do something like this :

tolower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'old','new')),
tolower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'Old','new')),
tolower(replace(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02'],'OLD','new'))

 

So nowmatter how the user types in the old domain, it understands to always change it to lower

Then a bit different order, make the whole response lowercase first, and then replace.

replace(toLower(body('Get_response_details')?['r82a060fd2a0d4f33abfca574c0159c02']),'olddomain','newdomain')

 



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,807)