cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NigelP
Kudo Kingpin
Kudo Kingpin

SharePoint For A Selected Item only works if PowerAutomate Flow is in the Default Environment

Hi

 

Am I correct in assuming that SharePoint "For A Selected Item" only works if the PowerAutomate Flow is in the Default Environment ?

 

Is there a way to trigger on when a List Item (Or Document in a Document Library) is selected into a PowerAutomate Flow which is not in a Default Environment ?

 

I have tried both the List Name and the List GUID in For a Selected Item trigger.

 

As a company we discourage the use of the Default Environment other than as a "PlayPen".  Definitely not to be used in a Production Environment.  All PowerAutomate Flows and PowerApps in Production must be in their own environment with appropriate DLPs applied.

 

Regards

 

Nigel

18 REPLIES 18
yashkamdar
Solution Sage
Solution Sage

Hello Team,

 

Am I correct in assuming that SharePoint "For A Selected Item" only works if the PowerAutomate Flow is in the Default Environment ?

 

Yes you are correct,  you cannot trigger Flows that have MANUAL trigger or that need to be triggered on Selected items via any environment other than the DEFAULT environment.

 

 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

 

 

 

CFernandes
Most Valuable Professional
Most Valuable Professional

Hey @NigelP 

 

I gave it a try and it did not work for me. I also see that other customer are facing similar problems, https://powerusers.microsoft.com/t5/Building-Flows/quot-For-a-selected-item-quot-Flow-only-works-in-...

 

I can think of a Work around you can create a Flow Launch button using column formatting, https://docs.microsoft.com/en-us/sharepoint/dev/declarative-customization/column-formatting#create-a... 

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!

Hi @yashkamdar 

 

So this means I will have to have one PowerAutomate Flow for each Document library and List in my SharePoint Online Estate - currently at around 1628 Document Libraries and Lists which have SP2010 Approval workflows on them according to the PnP Migration Tool !

 

Thats going mean navigating the Default Environment interesting !

 

Regards

 

Nigel

Ho @CFernandes 

 

This solves the problem of the flows not working :- Flow For-Selected-Item trigger and SharePoint Site Pages, in a detective story — John Liu .NET (john...

 

REgards

 

Nigel

Hello Team,

 

Unfortunately there is no easy way out of this. To be honest there are complicated ways and I do not want to mention them because everything comes with a limit anyways.

 

I would have asked you to Clone your Flows meaning Make a copy of your Flow but even that has a limit of 500 right now.

 

I would recommend you to discuss this with Support and check if they have something in place for this scenario, this looks pretty specific.

 

https://flow.microsoft.com/en-us/support/

 

powercorner
Continued Contributor
Continued Contributor

Hello @yashkamdar , @CFernandes @NigelP ,

Is the information above up to date?
We cannot use "Selected Item Trigger" outside of default environment?

Honestly, we are talking about ALM and create environments, take care about the governance and now this? Kind of a neckbreaker!?

 

With regards
Kevin

Hi @powercorner,

 

I totally agree with you. We are currently introducing Power Platform to our Company. We defined an environment strategy, governance documentation and an ALM process. Now we are facing the same Problem. SharePoint is our main DMS and we have a lot document based workflows, that are business critical. So we need to trigger many Flows starting from Documents or List-Entries. 

ALM does not work in that case because of the known limitations (SharePoint and also Teams triggers - For a selected item/file/message - do not work in other environments).

 

As a Workaround for the really critical Flows we started to create "Dummy Starter" Flows. They run in the "Default environment" (which, by the way, we have renamed to 'Personal Productvity' according to MS recommendation) and trigger the main Flows (ALM aware) via HTTP REST. But this means, that you need Premium Licenses to call the main Flow.

 😞

 

Best Regards

Marco

@NigelP 
Did you find any acceptable solution?

 

I read over the article by John Liu. It suggested using the List GUID ID for the "For A Selected Item" when trying to get a Flow to show up in a SharePoint Site Pages Library, but I still think it was using the Default Environment. I did try using the List ID when I saved a Flow from a different Environment, but the Flow did not show up in the Context Menu.

 

 @NigelP  - Were you able to get a Flow published in an Environment other than the Default Environment to show up in the Context Menu?

 

One of the benefits of creating a Flow with the SharePoint "For A Selected Item" trigger is that it adds the flow to the Context Menu and it is Security trimmed.

 

Others ( @CFernandes ) have suggested creating a button using Column JSON formatting which does work but it lacks the ability to put any Security trimming in place. If the button is clicked by a user without permission to run the flow, the flow dialog just never shows up.

 

 @marcodeluca 
I am interested in more information on the workaround you suggested for using a "Dummy Starter" Flow. How did you identify the correct Environment to run the main flows in (assuming that you have created a Solution that is promoted via ALM to your other Environments of Dev, Staging, and Prod)? How many Premium licenses did you find that this set-up needed?

 

I have also looked at other solutions such as using SPFX to create a ListView command. This implementation would need to launch the flow via an HTTP REST call resulting in the use of Premium Licenses.

It seems the best solution for this issue would be for the Microsoft SharePoint team to add the ability for a Site Admin to select the Power Platform Environment in a setting that the Context Menu would use in it's query to build out the list of Flows for a list.

 

 @yashkamdar 
I have to disagree with you regarding "this looks pretty specific". I guess this goes back to how the Power Platform should be viewed. It is a full fledged development environment where a company would want to have a traditional dev, staging, and production environment. Or should it be viewed more as a citizen developer platform where no one ventures out of a default environment. I think this is an important product enhancement that is best supported by the developer who coded the Context Menu in SharePoint who never realized that there would be an Environment other than the Default one.

 

Best Regards

Mark

@MarkBandR 

We discarded the idea of using the dummy flows, because of the premium licenses. Since I am not a licensing expert I do not recommend you to rely on the info I provide you in this post, but for us according to our TAM: every potential run-only user needed a premium license. Too much for us. So we decided to start the flows via "Flow-Button" using JSON-formatting of a column. For us this means, that we need to manage the start Workflow buttons ourselves.

Exactly, we have DEV, TEST and PROD environments. The correct flow is identified using the Flow Identifier. At the moment we are working on deploying the flow button column (including the JSON formatting) via PnP Provisioning engine as part of our CI/CD pipeline (wich unfortunately is still under construction).

@marcodeluca  Thanks for the reply.

I looked more at using a Flow-Button using the JSON column formatting but I wanted the button to only show up if the user had Permission greater than Read. [$PermMask] is available for this.

 

@MichaelBoehnke documented this here:

https://techcommunity.microsoft.com/t5/sharepoint/column-formatting-show-or-hide-columns-based-on-us...

 

(Thanks @MichaelBoehnke )

 

These are some of the values for [$PermMask] based on the users Permissions:

Full Control     0x7fffffffffffffff

Design             0x1b03c5f1bff

Edit                  0x1b03c431aef

Contribute      0x1b03c4312ef

Read                0xb008431061

View Only        0xb008431041

 

This even works at the item level.

 

Below is an example of Column formatting to show a Flow-Button if the user has Permission greater than Read to the Item:

{

  "$schema": https://developer.microsoft.com/json-schemas/sp/v2/column-formatting.schema.json,

  "elmType": "button",

  "customRowAction": {

    "action": "executeFlow",

    "actionParams": "{\"id\": \"YOUR_FLOW_ID\"}"

  },

  "attributes": {

    "class": "ms-fontColor-themePrimary ms-bgColor-themeDark--hover ms-fontColor-themeLighter--hover .ms-ContextualMenubutton"

  },

  "style": {

    "cursor": "pointer",

    "display": "=if([$PermMask]>='0xb00', 'none', '')"

  },

  "children": [

    {

      "elmType": "span",

      "attributes": {

        "iconName": "MicrosoftFlowLogo",

        "class": "ms-font-xxl"

      },

      "style": {

        "padding-right": "6px"

      }

    },

    {

      "elmType": "span",

      "txtContent": "Start Flow"

    }

  ]

}

 

@MarkBandR- Interesting solution. Couple of questions about this:
- Which flow trigger did you use to make this work? Was it "For a selected item"?

- Were you able to make this work in an environment other than Default (Personal Productivity)?

 

@robcaretta For the Flow trigger, I am using the "For a selected item". It gives the Flow the ID of the item. I also used this trigger so I could prompt the user for some additional information.

 

I am not currently using [$PermMask] in the Column Formatting JSON but that is because it has not been a requirement yet.

 

For different environments, you have to get the "Flow identifier" from the "Details" screen of the Flow using "Export"-"Get flow identifier". This value will look something like "v1/YOUR ENVIRONMENT GUID/YOUR FLOW GUID". That value would go in this line of the JSON:

"actionParams": "{\"id\": \"YOUR_FLOW_ID\"}"

 

You can find more information here from MS on the Flow button. You can set other things like headerText and runFlowButtonText

https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-advanced 

https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-referen... (look for "executeFlow")

 

There is another option for launching a Flow that I have not used but thought of using. But using the "setValue" action in the JSON Column formatting you could change a field value and use the "When an item is create or modified" for your trigger. The "customRowAction" would look something like this:

"customRowAction":{

   "action": "setValue",

   "actionInput": {

        "FieldInternalName_1": "FieldValue_1",

   }

}

 

Ref: https://learn.microsoft.com/en-us/sharepoint/dev/declarative-customization/formatting-syntax-referen... (see setValue)

 

You would set your Trigger - "Settings" - "Trigger Conditions" to look for the field you updated to be a certain value. When the Flow starts, you could immediately change your field back to a reset value. You know who launched the flow by referencing the "Modified By" field when the flow started. 

One advantage to this method is that the user is not prompted with authorizing connections, but you lose the ability to ask for additional information/inputs. You could also use "style" "display" in the JSON to hide the button when the Flow runs by basing the "display" formula on the field value (or multiple field values) that the button click changed/set.

When looking at the options for launching and running a Flow, it is important to also consider the licensing and throttling. Starting flows with "For a selected item" will run under the user that is selecting the item. "When an item is created or modified" will run under the license of the Owner of the flow. If the number of flows you are starting is less that a hundred or so a day, then you should be fine. If it is in the 1000s then you may need "For a selected item". I don't fully understand the licensing and throttling just yet but it is something to be aware of.

 

Hi All,

Apologies for jumping into an old thread but hopefully it adds some value. Trigr can deploy a single flow anywhere you need it in SharePoint (without copying it). And you'd be able to trigger said flow even if its not in the Default Environment for selected list items / library files and folders etc.

@NigelP - as Trigr allows you to deploy the Flow across SharePoint (or any group of lists / libraries you choose), you would not need to copy the flow for each targeted library. No more duplication and maintenance of flows!

@MarkBandR - the next release in early November will security trim flows deployed by Trigr based on the AD group permissions of the user in SharePoint. So flows deployed by Trigr will be security trimmed.

It comes with some other cool functions like the ability for multi list item / multi document selection to trigger flows on as well as user dynamic form input etc

Hope this helps for some ALM / other use cases!

cc @powercorner / @marcodeluca / @robcaretta / @CFernandes / @yashkamdar 



@MarkBandR-  Strange I am not able to get this working. I have a very basic flow is using the "For a selected item". Using the MS code with the proper flow ID. The flow is in a another environment though. It just does not trigger. Are you certain this technique works in non-default environments?

@robcaretta It does work. You need to check you "Run only users" from the Details screen for the flow to make sure you have set access. If the Flow is within a Power Automate Solution, you will need to set it to a group from that Environment (try typing "org" to find the group that contains everyone in that Power Automate Environment". If you are not in a Power Automate Solution, then you can select the SharePoint List for who can run it.

 

You also need to look at the Environment in Power Automate Admin to make sure the user has a "Basic User" Permission. In other words they are licensed in that Environment.

 

If they are clicking on the button and nothing is happening, then it is Permissions at some level either to the Flow or to the Environment.

@robcaretta make sure, that you get the flow ID from here:

marcodeluca_0-1666621099506.png 

Otherwise, the flow will not start because the reference to the environment is missing.

 

Regards
Marco

Microsoft documentation here for "executeFlow" represents it as just the GUID for the flow.  So that is not entirely accurate.

 

Got it.  So it's the FULL identifier like this v1/{EnvironmentGUID}/{FlowGUID}, not just a portion of it. I was able to get it to fire off now.  Thank you for the prompt responses!!!

Thanks @MarkBandR - using the 'Get Flow Identifier' from Power Automate and using the full ID in my custom JSON formatting (where I add various buttons in list view formatting) has done the trick. 

Helpful resources

Announcements

Community will be READ ONLY July 16th, 5p PDT -July 22nd

Dear Community Members,   We'd like to let you know of an upcoming change to the community platform: starting July 16th, the platform will transition to a READ ONLY mode until July 22nd.   During this period, members will not be able to Kudo, Comment, or Reply to any posts.   On July 22nd, please be on the lookout for a message sent to the email address registered on your community profile. This email is crucial as it will contain your unique code and link to register for the new platform encompassing all of the communities.   What to Expect in the New Community: A more unified experience where all products, including Power Apps, Power Automate, Copilot Studio, and Power Pages, will be accessible from one community.Community Blogs that you can syndicate and link to for automatic updates. We appreciate your understanding and cooperation during this transition. Stay tuned for the exciting new features and a seamless community experience ahead!

Summer of Solutions | Week 4 Results | Winners will be posted on July 24th

We are excited to announce the Summer of Solutions Challenge!    This challenge is kicking off on Monday, June 17th and will run for (4) weeks.  The challenge is open to all Power Platform (Power Apps, Power Automate, Copilot Studio & Power Pages) community members. We invite you to participate in a quest to provide solutions to as many questions as you can. Answers can be provided in all the communities.    Entry Period: This Challenge will consist of four weekly Entry Periods as follows (each an “Entry Period”)   - 12:00 a.m. PT on June 17, 2024 – 11:59 p.m. PT on June 23, 2024 - 12:00 a.m. PT on June 24, 2024 – 11:59 p.m. PT on June 30, 2024 - 12:00 a.m. PT on July 1, 2024 – 11:59 p.m. PT on July 7, 2024 - 12:00 a.m. PT on July 8, 2024 – 11:59 p.m. PT on July 14, 2024   Entries will be eligible for the Entry Period in which they are received and will not carryover to subsequent weekly entry periods.  You must enter into each weekly Entry Period separately.   How to Enter: We invite you to participate in a quest to provide "Accepted Solutions" to as many questions as you can. Answers can be provided in all the communities. Users must provide a solution which can be an “Accepted Solution” in the Forums in all of the communities and there are no limits to the number of “Accepted Solutions” that a member can provide for entries in this challenge, but each entry must be substantially unique and different.    Winner Selection and Prizes: At the end of each week, we will list the top ten (10) Community users which will consist of: 5 Community Members & 5 Super Users and they will advance to the final drawing. We will post each week in the News & Announcements the top 10 Solution providers.  At the end of the challenge, we will add all of the top 10 weekly names and enter them into a random drawing.  Then we will randomly select ten (10) winners (5 Community Members & 5 Super Users) from among all eligible entrants received across all weekly Entry Periods to receive the prize listed below. If a winner declines, we will draw again at random for the next winner.  A user will only be able to win once overall. If they are drawn multiple times, another user will be drawn at random.  Individuals will be contacted before the announcement with the opportunity to claim or deny the prize.  Once all of the winners have been notified, we will post in the News & Announcements of each community with the list of winners.   Each winner will receive one (1) Pass to the Power Platform Conference in Las Vegas, Sep. 18-20, 2024 ($1800 value). NOTE: Prize is for conference attendance only and any other costs such as airfare, lodging, transportation, and food are the sole responsibility of the winner. Tickets are not transferable to any other party or to next year’s event.   ** PLEASE SEE THE ATTACHED RULES for this CHALLENGE**   Week 1 Results: Congratulations to the Week 1 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge.   Community MembersNumber SolutionsSuper UsersNumber Solutions Deenuji 9 @NathanAlvares24  17 @Anil_g  7 @ManishSolanki  13 @eetuRobo  5 @David_MA  10 @VishnuReddy1997  5 @SpongYe  9JhonatanOB19932 (tie) @Nived_Nambiar  8 @maltie  2 (tie)   @PA-Noob  2 (tie)   @LukeMcG  2 (tie)   @tgut03  2 (tie)       Week 2 Results: Congratulations to the Week 2 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 2: Community MembersSolutionsSuper UsersSolutionsPower Automate  @Deenuji  12@ManishSolanki 19 @Anil_g  10 @NathanAlvares24  17 @VishnuReddy1997  6 @Expiscornovus  10 @Tjan  5 @Nived_Nambiar  10 @eetuRobo  3 @SudeepGhatakNZ 8     Week 3 Results: Congratulations to the Week 3 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 3:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji32ManishSolanki55VishnuReddy199724NathanAlvares2444Anil_g22SudeepGhatakNZ40eetuRobo18Nived_Nambiar28Tjan8David_MA22   Week 4 Results: Congratulations to the Week 4 qualifiers, you are being entered in the random drawing that will take place at the end of the challenge. Week 4:Community MembersSolutionsSuper UsersSolutionsPower Automate Deenuji11FLMike31Sayan11ManishSolanki16VishnuReddy199710creativeopinion14Akshansh-Sharma3SudeepGhatakNZ7claudiovc2CFernandes5 misc2Nived_Nambiar5 Usernametwice232rzaneti5 eetuRobo2   Anil_g2   SharonS2  

Check Out | 2024 Release Wave 2 Plans for Microsoft Dynamics 365 and Microsoft Power Platform

On July 16, 2024, we published the 2024 release wave 2 plans for Microsoft Dynamics 365 and Microsoft Power Platform. These plans are a compilation of the new capabilities planned to be released between October 2024 to March 2025. This release introduces a wealth of new features designed to enhance customer understanding and improve overall user experience, showcasing our dedication to driving digital transformation for our customers and partners.    The upcoming wave is centered around utilizing advanced AI and Microsoft Copilot technologies to enhance user productivity and streamline operations across diverse business applications. These enhancements include intelligent automation, AI-powered insights, and immersive user experiences that are designed to break down barriers between data, insights, and individuals. Watch a summary of the release highlights.    Discover the latest features that empower organizations to operate more efficiently and adaptively. From AI-driven sales insights and customer service enhancements to predictive analytics in supply chain management and autonomous financial processes, the new capabilities enable businesses to proactively address challenges and capitalize on opportunities.    

Updates to Transitions in the Power Platform Communities

We're embarking on a journey to enhance your experience by transitioning to a new community platform. Our team has been diligently working to create a fresh community site, leveraging the very Dynamics 365 and Power Platform tools our community advocates for.  We started this journey with transitioning Copilot Studio forums and blogs in June. The move marks the beginning of a new chapter, and we're eager for you to be a part of it. The rest of the Power Platform product sites will be moving over this summer.   Stay tuned for more updates as we get closer to the launch. We can't wait to welcome you to our new community space, designed with you in mind. Let's connect, learn, and grow together.   Here's to new beginnings and endless possibilities!   If you have any questions, observations or concerns throughout this process please go to https://aka.ms/PPCommSupport.   To stay up to date on the latest details of this migration and other important Community updates subscribe to our News and Announcements forums: Copilot Studio, Power Apps, Power Automate, Power Pages

Users online (1,027)