web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Global variable for flows
Power Automate
Unanswered

Global variable for flows

(0) ShareShare
ReportReport
Posted on by 7

Hello, 

 

I am using a dozen of flows that all use the same condition string. This condition filters e-mails based on characteristics. New insights lead to modifying the condition which I have to then copy into 12 flows.


Is it possible to create a global variable containing this string which I can call from the condition element in my flows? 

 

Regards, Sander

Categories:
I have the same question (0)
  • Verified answer
    PieterVeenstra Profile Picture
    on at

    Hi @sanniep,

    If you are looking for global varibales acrossmultiple flows then I would recommend storing the data that you are looking for somewhere central outside the flows. e.g. SharePoint list. This also has another benefit. Imagine that you want to update this variable (actually it sounds like this is a constant ratehr than a variable)? Then all you have to do is update the avriable in a single place and all flows willpick up the value.

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @sanniep

     

     

    What @Pieter_Veenstra says seems to be the correct way to "make" global variables in Flow.

    As of today there is no option to create global variables you can use across multiple Flows.

     

    Kind regards

     

    Tom

  • sanniep Profile Picture
    7 on at

    Can you help me with another piece of this puzzle? So, I've got the constant (you're right) loaded into a variable called 'condition':

     

    @or(contains(toupper(triggerBody()?['Subject']), 'FACTUUR'),contains(toupper(triggerBody()?['Subject']), 'REKENING'),contains(toupper(triggerBody()?['Subject']), 'INVOICE'),contains(toupper(triggerBody()?['Subject']), 'RECHNUNG'),contains(toupper(triggerBody()?['Subject']), 'FAKTUUR'),contains(toupper(triggerBody()?['Subject']), 'FAKTUREN'),contains(toupper(triggerBody()?['Subje.... etc

     

    But how do I call this string as a condition? Thanks again.

     

    Screenshot_4.jpg

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

    Regards, Sander

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @sanniep

     

     

    You shouldn't put the whole condition in your variable, only the things that occur more frequently like

    contains(toupper(triggerBody()?['Subject']))

    variables1_Flow.PNGvariables_Flow.PNG

     

    Hope this helps.

     

    Kind regards

     

     

    Tom

  • sanniep Profile Picture
    7 on at

    Thanks, @Tom_Slosse

     

    Well, I am new with flow so I am learning. But I've got 12 flows using the same conditions. This one and another for negative keywords.

    What I want to do is manage the positive and negative keywords centrally so I don't need to update all flows everytime we think of a new keyword.

     

    So I use a Sharepoint list to manage the 2 conditions thanks to the advise in this post. But it are the keywords I want to centralize for easy management, the redundancy in expressions is not that my concern at this point.

     

    Maybe there is another way to check the email subject and body for a set of keywords. I thought loading the expression from a global variable like this was most efficient.

  • Tom_Slosse Profile Picture
    1,430 on at

    Hey @sanniep

     

    I understand your thinking but in a condition something needs to be evaluated if its true or false.

    A single variable wouldn't do it so even if that variable contains your condition. The condition will take your variable as just text.

    So I think you can't put your whole condition in a variable

     

    Kind regards

     

     

    Tom

  • Thenerdy Profile Picture
    58 on at

    There's now something called environment variables and may be for you. I know I was looking for it for a while as it didn't make sense to use something completely external to poweautomate.

    http://www.ludovicperrichon.com/set-environment-variables-with-powerautomate/#powerautomateflowvar

    https://devoworx.net/environment-variable-in-power-platform/

  • StephenDear Profile Picture
    6 on at

    most efficient way would be what you had but the most maintainable way would be a SharePoint list or comma delimited environment variable split into an array and checked in an Apply to each loop. Wouldn't take long to execute but if the list becomes very long you could look at other optimisation techniques like Peter Veinstra demonstrates here: Compare two arrays, tables or lists a lot faster in Power Automate (sharepains.com). Sorry, didn't realise the thread was so old.... :S

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard