cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JustAPACreator
Advocate II
Advocate II

Reusing the output of a Variable in different actions/steps

Hi,

 

I'm trying to reuse the same output from a variable in multiple steps but the second "call" for the value of the variable produces a blank e.g.:

This is the variable I want to use: 

JustAPACreator_0-1656070567342.png


When I use that variable output in the first email step it enters it fine and the email appears as it should:

JustAPACreator_1-1656070685514.pngJustAPACreator_2-1656070723372.png

But when I use it a second time in a 'Send an email' step further down it shows as a blank in the physical email that is sent and looking at the Run for that flow shows this (Wokka Woka is a fictional name FYI).The document name should've been in-between your and document but it's just blank:

JustAPACreator_3-1656070864521.png

JustAPACreator_4-1656070980510.png

How can I reuse variable outputs more than once in the same flow without having to create a unique one for every reference I want to use it for please?

Thanks is in advance.

Mark.

22 REPLIES 22
VictorIvanidze
Community Champion
Community Champion

Hello,

you are using wrong terminology - I don't see any variable in your screenshot.

Also please show the whole your flow.

________________________________________________________

Welcome to my web site.

Hi,

 

Thanks for the questions, maybe you could help by advising what I am referencing as clearly I'm new and trying to learn?

The whole flow is too big to post hence the parts that I thought would highlight the error.

The aim was to use the "result" of the Compose - File Name "step" multiple times in a flow instead of just the first use "using it up" and any subsequent reference to it producing a blank.

These are the "variables":

JustAPACreator_0-1656074375318.png

JustAPACreator_2-1656074710947.png


Which does the leg work for this "action/step":

JustAPACreator_1-1656074411434.png

 

Which is then used in email one (Outputs):

JustAPACreator_3-1656074763548.png

 

Then in email two:

JustAPACreator_4-1656074799506.png

 

The two emails are under two Conditions which match based on the Form dynamic content matching and then sends the relevant email.

 

Hope that helps.

 

Mark.

VictorIvanidze
Community Champion
Community Champion

It looks like the value of variable "Sanitise" and the output of Compose action are equal, correct?

If so, try to use variables('Sanitise') instead of Outputs() in the emails.

________________________________________________________

Welcome to my web site.

Hi,

 

Thanks for the quick response: I tried that and while one email (the original step that held the value) has the document name as expected the second still has a blank, exactly the same setup in both email steps/actions I even copied the body from the working one to the non-working one):

 

JustAPACreator_0-1656076566242.png

I just can't work out what I'm doing wrong, sorry.

VictorIvanidze
Community Champion
Community Champion

Try to publish here the fragment of your flow that covers all places there "sanitise" variable exists.

________________________________________________________

Welcome to my web site.

Not a problem, so the main Flow branches into two. This is the right-side branch that deals with one company based on a condition that looks for the value from the Form, this is also the one that works and was created first in the Flow:

JustAPACreator_2-1656080808186.png

 

This is the second left-branch that deals with the other company (both are identical except company names and document filenames). This one doesn't work:

JustAPACreator_1-1656080621261.png

 

Hope they haven't come out too small for you, if you need anything further please let me know.

 

Thank you for your time and trying to help, it is appreciate.

 

Mark.

VictorIvanidze
Community Champion
Community Champion

Where exactly do you see the blank document name? Mark these places.

________________________________________________________

Welcome to my web site.

Document name should be inserted from the "sanitise" variable highlighted here in both emails (I kept the old Output field in there so I could reference it later):

JustAPACreator_5-1656084023751.png

 

The "sanitise" should insert the document name and then the email should come through looking like this:

JustAPACreator_2-1656083817440.png

Instead it comes through looking like this (highlighted in yellow the space where the name should be) if I try to use the second branch which "reuses" the "sanitise" variable:

JustAPACreator_3-1656083928696.png

Helps that helps further.

VictorIvanidze
Community Champion
Community Champion

Sorry I do no understand what is the second branch. If you cannot provide the whole picture I cannot help.

________________________________________________________

Welcome to my web site.

OK, let's try it this way:

I've got a name from a Microsoft Form that has been cleaned and removed all the [ and " from the name.

That's stored in a variable called sanitise.

Sanitise is used in an email as Dynamic content.

I use the Sanitise as Dynamic content to insert the document name into a "Send an email" action.

This works if I only use it once in the Flow.

If I try and use it again in another "Send an email" action the email doesn't contain the values in the Sanitise variable, it just equates to blank but the first email does have the values.

Discovered I could zoom out (d'oh) so here's the entire process:

JustAPACreator_0-1656087422753.png

This branches to this part (right side (created first) works and left doesn't):

JustAPACreator_2-1656087636140.png

 

 

VictorIvanidze
Community Champion
Community Champion

Aha! It looks like you are using 2 parallel branches. For what?

________________________________________________________

Welcome to my web site.

For the two different companies this flow needs to pull documents for. It was originally without branching but I thought it would be easier to manage it in two branches.

VictorIvanidze
Community Champion
Community Champion

In other words: no parallel branches - no problem with the variable, correct?

________________________________________________________

Welcome to my web site.

I had trouble with the variable before I put them into parallel branches, they were what I was hoping might be the answer 😞

VictorIvanidze
Community Champion
Community Champion

Sorry I do not believe that. Can you show a flow that has a variable problem without parallelism?

________________________________________________________

Welcome to my web site.

I did at the very start, I've never been able to reuse a variable. It has the problem, why would I lie and waste mine and your time on this? Thanks for your help anyway, maybe someone else has some ideas.

VictorIvanidze
Community Champion
Community Champion

Please don't be offended.  To localize the problem I'd like to see a complete flow that I can reproduce.

Could you provide such thing?

________________________________________________________

Welcome to my web site.

JustAPACreator
Advocate II
Advocate II

Hi, sure and apologies. I've got a few Flows where this isn't working. Let me see if I can remove sensitive data and sort one out for you. I really appreciate any help.

edgarsimoes
Employee
Employee

Hello @JustAPACreator 

 

I look into the conversation between you and @VictorIvanidze and although I understood your issue, I am not being able to reproduce because I don't have all the information to do it in a more complete way and so I'm not getting the issue that you're facing. You can see my reproduction trial here:

Reusing the output of a Variable in different actions.png

 

I used a sample form and try to use both compose and variable just like you but I still don't get the issue you're facing.

 

So, I tried to investigate more about your issue and I saw that there other users facing the same issue on a different community forum post: Solved: Can't access variables in send an email - Power Platform Community (microsoft.com)

 

And, even though is not the same, I would suggest you to try this idea:

1. Move your cursor towards the other string value mappings. It will show the tooltip how that is mapped. Use the same syntax (different variable name here) under the expressions.

2. Easiest way is add a compose step before the email step. Map the value. Map the compose output to email.

 

Let me know if it works. And if it does, please mark this answer as resolved.

 

Happy automating,

 

Edgar Simões

Helpful resources

Announcements

Celebrating the May Super User of the Month: Laurens Martens

  @LaurensM  is an exceptional contributor to the Power Platform Community. Super Users like Laurens inspire others through their example, encouragement, and active participation. We are excited to celebrated Laurens as our Super User of the Month for May 2024.   Consistent Engagement:  He consistently engages with the community by answering forum questions, sharing insights, and providing solutions. Laurens dedication helps other users find answers and overcome challenges.   Community Expertise: As a Super User, Laurens plays a crucial role in maintaining a knowledge sharing environment. Always ensuring a positive experience for everyone.   Leadership: He shares valuable insights on community growth, engagement, and future trends. Their contributions help shape the Power Platform Community.   Congratulations, Laurens Martens, for your outstanding work! Keep inspiring others and making a difference in the community!   Keep up the fantastic work!        

Check out the Copilot Studio Cookbook today!

We are excited to announce our new Copilot Cookbook Gallery in the Copilot Studio Community. We can't wait for you to share your expertise and your experience!    Join us for an amazing opportunity where you'll be one of the first to contribute to the Copilot Cookbook—your ultimate guide to mastering Microsoft Copilot. Whether you're seeking inspiration or grappling with a challenge while crafting apps, you probably already know that Copilot Cookbook is your reliable assistant, offering a wealth of tips and tricks at your fingertips--and we want you to add your expertise. What can you "cook" up?   Click this link to get started: https://aka.ms/CS_Copilot_Cookbook_Gallery   Don't miss out on this exclusive opportunity to be one of the first in the Community to share your app creation journey with Copilot. We'll be announcing a Cookbook Challenge very soon and want to make sure you one of the first "cooks" in the kitchen.   Don't miss your moment--start submitting in the Copilot Cookbook Gallery today!     Thank you,  Engagement Team

Announcing Power Apps Copilot Cookbook Gallery

We are excited to share that the all-new Copilot Cookbook Gallery for Power Apps is now available in the Power Apps Community, full of tips and tricks on how to best use Microsoft Copilot as you develop and create in Power Apps. The new Copilot Cookbook is your go-to resource when you need inspiration--or when you're stuck--and aren't sure how to best partner with Copilot while creating apps.   Whether you're looking for the best prompts or just want to know about responsible AI use, visit Copilot Cookbook for regular updates you can rely on--while also serving up some of your greatest tips and tricks for the Community. Check Out the new Copilot Cookbook for Power Apps today: Copilot Cookbook - Power Platform Community.  We can't wait to see what you "cook" up!    

Welcome to the Power Automate Community

You are now a part of a fast-growing vibrant group of peers and industry experts who are here to network, share knowledge, and even have a little fun.   Now that you are a member, you can enjoy the following resources:   Welcome to the Community   News & Announcements: The is your place to get all the latest news around community events and announcements. This is where we share with the community what is going on and how to participate.  Be sure to subscribe to this board and not miss an announcement.   Get Help with Power Automate Forums: If you're looking for support with any part of Power Automate, our forums are the place to go. From General Power Automate forums to Using Connectors, Building Flows and Using Flows.  You will find thousands of technical professionals, and Super Users with years of experience who are ready and eager to answer your questions. You now have the ability to post, reply and give "kudos" on the Power Automate community forums. Make sure you conduct a quick search before creating a new post because your question may have already been asked and answered. Galleries: The galleries are full of content and can assist you with information on creating a flow in our Webinars and Video Gallery, and the ability to share the flows you have created in the Power Automate Cookbook.  Stay connected with the Community Connections & How-To Videos from the Microsoft Community Team. Check out the awesome content being shared there today.   Power Automate Community Blog: Over the years, more than 700 Power Automate Community Blog articles have been written and published by our thriving community. Our community members have learned some excellent tips and have keen insights on the future of process automation. In the Power Automate Community Blog, you can read the latest Power Automate-related posts from our community blog authors around the world. Let us know if you'd like to become an author and contribute your own writing — everything Power Automate-related is welcome.   Community Support: Check out and learn more about Using the Community for tips & tricks. Let us know in the Community Feedback  board if you have any questions or comments about your community experience. Again, we are so excited to welcome you to the Microsoft Power Automate community family. Whether you are brand new to the world of process automation or you are a seasoned Power Automate veteran - our goal is to shape the community to be your 'go to' for support, networking, education, inspiration and encouragement as we enjoy this adventure together.     Power Automate Community Team

Hear what's next for the Power Up Program

Hear from Principal Program Manager, Dimpi Gandhi, to discover the latest enhancements to the Microsoft #PowerUpProgram, including a new accelerated video-based curriculum crafted with the expertise of Microsoft MVPs, Rory Neary and Charlie Phipps-Bennett. If you’d like to hear what’s coming next, click the link below to sign up today! https://aka.ms/PowerUp  

Tuesday Tip | How to Report Spam in Our Community

It's time for another TUESDAY TIPS, your weekly connection with the most insightful tips and tricks that empower both newcomers and veterans in the Power Platform Community! Every Tuesday, we bring you a curated selection of the finest advice, distilled from the resources and tools in the Community. Whether you’re a seasoned member or just getting started, Tuesday Tips are the perfect compass guiding you across the dynamic landscape of the Power Platform Community.   As our community family expands each week, we revisit our essential tools, tips, and tricks to ensure you’re well-versed in the community’s pulse. Keep an eye on the News & Announcements for your weekly Tuesday Tips—you never know what you may learn!   Today's Tip: How to Report Spam in Our Community We strive to maintain a professional and helpful community, and part of that effort involves keeping our platform free of spam. If you encounter a post that you believe is spam, please follow these steps to report it: Locate the Post: Find the post in question within the community.Kebab Menu: Click on the "Kebab" menu | 3 Dots, on the top right of the post.Report Inappropriate Content: Select "Report Inappropriate Content" from the menu.Submit Report: Fill out any necessary details on the form and submit your report.   Our community team will review the report and take appropriate action to ensure our community remains a valuable resource for everyone.   Thank you for helping us keep the community clean and useful!

Users online (3,883)