Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Replace space in variable with period

(1) ShareShare
ReportReport
Posted on by 4

I am calling a flow from Power Virtual Agents, I am passing the user name that contains spaces e.g. Fred A Smith and I want to replace the spaces with a period i.e. Fred.A.Smith to use in a API call 

 

I initialized a variable USER_NAME with the UserName that was passed to the flow

 

I thought it would be a simple matter of using the compose to replace the characters, but no matter what I try  the USER_NAME string is not been updated. And as a result the API does not return anything.

djox_0-1658940753181.png

 

If I create a test variable in the correct format and pass that to the API my flow works correctly.

 

Am I missing something obvious?

 

  • Verified answer
    Shujaath_Khan Profile Picture
    1,111 Super User 2024 Season 1 on at
    Re: Replace space in variable with period

    Hi @djox 

     

    replace(variables('USER_NAME'),' ','F')

     This is sufficient in compose which should do.

    Thanks

    Please click Accept as Solution on this reply if it helped to solve your issue, and thumbs-up if you feel this is useful or important in other ways as a boost.

  • Caspar_Rubin Profile Picture
    830 on at
    Re: Replace space in variable with period

    Instead of using the %32 etc. I usually just create a new String Variable (initialize variable) called "Space" and just put a space in it...

    Then i can use this formula: 

     

     

    replace(variables('UserName'),variables('Space'),'.')

     


    2022-07-27_19h15_30.png

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Output:

     

    2022-07-27_19h17_28.png

     

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 >