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

SharePoint if item is modified --> update file properties

I have a requirement which is the following: when a field is modified in List A, the same field in Library B must be updated too, but only if Title of the modified item in List A is equal to Title of Library B.

 

The problem is that the flow updates every item in Library B. So if I modify item 1, it will update all the items in Library B with the modified value, and not only the items where condition Title is equal to Title.

 

In this case, CollectionYear will be updated to every item in the library.

 

Capture.pngUntitled.png

 

 

14 REPLIES 14
faustocapellanj
Memorable Member
Memorable Member

Hi @Gines,

 

 

I tried to replicate your scenario and this is what I came up with:

  1. I used the same first 2 steps you have on your Flow.
  2. After those 2 steps, I added a Data Operations - Filter Array step. In the From field, I selected the value from the Get files (properties only) step.
    FilePropertires-1.JPG
  3. In the next field, I selected the Name property from the Get files (properties only) step.
    FilePropertires-2.JPG
  4. For the filter, I selected contains and in the next field I selected the Title property from the When an item is created step.
    FilePropertires-3.JPG
  5. Next, I added a Condition to check if the Filter Array is true. I used the expression below. Make sure you edit the Condition in advanced mode.
    @equals(length(body('Filter_array')), 1)
    FilePropertires-4.JPG
  6. If the Condition is true, then I proceeded to update the desired file property.
    FilePropertires-5.JPG

Please try those steps and let me know if you need additional help.

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Hi @faustocapellanj,

 

Thanks for your reply, but it isn't working. The output in filter array is always empty, whereafter the expression result in the condition is false. I use a lookup field to check if the condition is true in filter array, maybe lookup field isn't supported yet, I don't know for sure.

Hi @Gines,

 

Since you need to update a document when a SharePoint list item is updated, how about you use the Title column in the document library as a unique identifier and use that in the Filter Query? For example, let's say you get the value of the SharePoint list Title column and assign this value to the Document library Title column. Then in the Get Files (properties only) step, you filter the document using the Filter Query odata field. Look at this solution I worked on with another user a while back, especially at the Get items and Condition steps. You will need something similar to that.

In the Get files (properties only), you will use the Document library Title column and see if it's equals to the SP list Title column. As for the Condition, it will check if the Filter Query is true or false. Try that and let me know.

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

Hi @faustocapellanj

 

I have tried it before with the Filter Query OData, but still not working. In the filter query I use "Title_field eq 'Title (dynamic field)' ", but the expression result is still false.

Title_field is a lookup field on the first list and I use underscore in the name, Flow can handle that, right?

 

Can you give me the link to the solution you worked on with another user?

 

Regards,

Gines

Gines
Advocate II
Advocate II

@faustocapellanj

I have managed to get it work. I have used the same actions and steps as I have stated in the first post, but the problem was the apply to each in 'Update file properties' action. It automatically appeared when I fill in the collectionyear value in 'Update file properties'. By removing the apply to each step, the flow is now working as I wanted to.

 

But I created another problem Smiley Embarassed

I have another flow in the same library: when the flow of this topic is succeeded, the other flow starts automatically running because the trigger is 'when a file is created or modified'. By updating the file properties in the 1st flow, the 2nd flow thinks it's a trigger for its own flow. 

 

Any idea how I can prevent this? What I actually want is a two-way syncing in a list and a library if an item is changed, but with this method now it will always start the 2nd flow. It's hard to explain but I hope someone understands me Smiley Tongue

 

Anyway, thanks for your help @faustocapellanj.

Hi @Gines,

 

One thing you can try is setting a condition in your 2nd flow to stop it right after it starts. What tha condition will be, I'm not sure. You will have to see at what point from the 1st flow you want the 2nd to start. As for the link from my previous, I totally forgot to add it. My apologies. Here's the link.

 

Regards,

Fausto Capellan, Jr

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!
BioDave
Frequent Visitor

@Gines .  How were you able to remove the 'Apply to each'?  I am having the same issues that you were having and have hit a brick wall.

Thanks in advance for your help.

@BioDave , if you remove the dynamic content column in your action which is referring to the value of apply to each, you will be able to move that action outside the apply to each. But it depends on what you actually want to do. What's your scenario?

BioDave
Frequent Visitor

@Gines  I have a SP List that is updated via an PowerApp or manually through SP.  The flow I want to use must take the modifications to the SP list and then update a SP library metadata with those modifications.  Basically, when SP List A is modified, Flow will modify SP Document Library B.  

Hi @BioDave 

An Apply to each action is inserted automatically when the data you are working with is part of an array, even if the array only contains one item. To avoid the automatic Apply to each, you should wrap up the dynamic content inside a first() expression. For example, your action is called Get Users and the dynamic content field is called Username, you can do an expression similar to the one below:

first(body('Get_Users'))?['Username']

This will prevent the automatic Apply to each, but you will only be able with the first item of the array. I hope that helps.

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

@faustocapellanj  I am quite new to the Flow, so where would I be putting your code?  I have included the flow configuration that I am trying based on the your suggestions above.  I am also confused as to how to write the conditions as there isn't an advanced mode for writing conditions any more.

Thanks again for your help.

Update Document Library Metadata When List Item is Updated1.png

 The Filter array action is used to filter the items from the Get files (properties only) action. The left side should be Name, which comes from the Get files (properties only) action and the right side should be Title, which comes from your trigger. As for the Condition, you have to use an expression similar to the one in my original post, but this is how you would do it since you can't do advanced edits anymore:

  1. Click inside the left box to bring up the Dynamic content window and then click on the Expresions tab. Enter the expression below.Then change your logical operator to is greater than, and on the right box, enter a 0. This will check if the Filter array contains any items.
  2. Then proceed to add the actions for the Yes and No branches.
length(body('Filter_array'))

 

Fausto Capellan, Jr
Did I answer your question? Mark my post as a solution! Did my response help? Please give it a thumbs up!

@faustocapellanj 

I have updated my flow as you suggested and it is working, with the exception that the flow is updating all document library records rather than just a single record.  Am I doing something wrong after the filter array?  I tried the condition greater the 0, as well as the condition greater the function 0.  Both gave the same results.Update Document Library Metadata When List Item is Updated2.png

@faustocapellanj 

I am also unsure how and where wrap up the dynamic content to avoid automatic Apply to each. 

 

 "To avoid the automatic Apply to each, you should wrap up the dynamic content inside a first() expression. ' 

Helpful resources

Announcements

Exclusive LIVE Community Event: Power Apps Copilot Coffee Chat with Copilot Studio Product Team

It's time for the SECOND Power Apps Copilot Coffee Chat featuring the Copilot Studio product team, which will be held LIVE on April 3, 2024 at 9:30 AM Pacific Daylight Time (PDT).     This is an incredible opportunity to connect with members of the Copilot Studio product team and ask them anything about Copilot Studio. We'll share our special guests with you shortly--but we want to encourage to mark your calendars now because you will not want to miss the conversation.   This live event will give you the unique opportunity to learn more about Copilot Studio plans, where we’ll focus, and get insight into upcoming features. We’re looking forward to hearing from the community, so bring your questions!   TO GET ACCESS TO THIS EXCLUSIVE AMA: Kudo this post to reserve your spot! Reserve your spot now by kudoing this post.  Reservations will be prioritized on when your kudo for the post comes through, so don't wait! Click that "kudo button" today.   Invitations will be sent on April 2nd.Users posting Kudos after April 2nd at 9AM PDT may not receive an invitation but will be able to view the session online after conclusion of the event. Give your "kudo" today and mark your calendars for April 3, 2024 at 9:30 AM PDT and join us for an engaging and informative session!

Tuesday Tip: Unlocking Community Achievements and Earning Badges

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!     THIS WEEK'S TIP: Unlocking Achievements and Earning BadgesAcross the Communities, you'll see badges on users profile that recognize and reward their engagement and contributions. These badges each signify a different achievement--and all of those achievements are available to any Community member! If you're a seasoned pro or just getting started, you too can earn badges for the great work you do. Check out some details on Community badges below--and find out more in the detailed link at the end of the article!       A Diverse Range of Badges to Collect The badges you can earn in the Community cover a wide array of activities, including: Kudos Received: Acknowledges the number of times a user’s post has been appreciated with a “Kudo.”Kudos Given: Highlights the user’s generosity in recognizing others’ contributions.Topics Created: Tracks the number of discussions initiated by a user.Solutions Provided: Celebrates the instances where a user’s response is marked as the correct solution.Reply: Counts the number of times a user has engaged with community discussions.Blog Contributor: Honors those who contribute valuable content and are invited to write for the community blog.       A Community Evolving Together Badges are not only a great way to recognize outstanding contributions of our amazing Community members--they are also a way to continue fostering a collaborative and supportive environment. As you continue to share your knowledge and assist each other these badges serve as a visual representation of your valuable contributions.   Find out more about badges in these Community Support pages in each Community: All About Community Badges - Power Apps CommunityAll About Community Badges - Power Automate CommunityAll About Community Badges - Copilot Studio CommunityAll About Community Badges - Power Pages Community

Tuesday Tips: Powering Up Your Community Profile

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!   This Week's Tip: Power Up Your Profile!  🚀 It's where every Community member gets their start, and it's essential that you keep it updated! Your Community User Profile is how you're able to get messages, post solutions, ask questions--and as you rank up, it's where your badges will appear and how you'll be known when you start blogging in the Community Blog. Your Community User Profile is how the Community knows you--so it's essential that it works the way you need it to! From changing your username to updating contact information, this Knowledge Base Article is your best resource for powering up your profile.     Password Puzzles? No Problem! Find out how to sync your Azure AD password with your community account, ensuring a seamless sign-in. No separate passwords to remember! Job Jumps & Email Swaps Changed jobs? Got a new email? Fear not! You'll find out how to link your shiny new email to your existing community account, keeping your contributions and connections intact. Username Uncertainties Unraveled Picking the perfect username is crucial--and sometimes the original choice you signed up with doesn't fit as well as you may have thought. There's a quick way to request an update here--but remember, your username is your community identity, so choose wisely. "Need Admin Approval" Warning Window? If you see this error message while using the community, don't worry. A simple process will help you get where you need to go. If you still need assistance, find out how to contact your Community Support team. Whatever you're looking for, when it comes to your profile, the Community Account Support Knowledge Base article is your treasure trove of tips as you navigate the nuances of your Community Profile. It’s the ultimate resource for keeping your digital identity in tip-top shape while engaging with the Power Platform Community. So, dive in and power up your profile today!  💪🚀   Community Account Support | Power Apps Community Account Support | Power AutomateCommunity Account Support | Copilot Studio  Community Account Support | Power Pages

Super User of the Month | Chris Piasecki

In our 2nd installment of this new ongoing feature in the Community, we're thrilled to announce that Chris Piasecki is our Super User of the Month for March 2024. If you've been in the Community for a while, we're sure you've seen a comment or marked one of Chris' helpful tips as a solution--he's been a Super User for SEVEN consecutive seasons!   Since authoring his first reply in April 2020 to his most recent achievement organizing the Canadian Power Platform Summit this month, Chris has helped countless Community members with his insights and expertise. In addition to being a Super User, Chris is also a User Group leader, Microsoft MVP, and a featured speaker at the Microsoft Power Platform Conference. His contributions to the new SUIT program, along with his joyous personality and willingness to jump in and help so many members has made Chris a fixture in the Power Platform Community.   When Chris isn't authoring solutions or organizing events, he's actively leading Piasecki Consulting, specializing in solution architecture, integration, DevOps, and more--helping clients discover how to strategize and implement Microsoft's technology platforms. We are grateful for Chris' insightful help in the Community and look forward to even more amazing milestones as he continues to assist so many with his great tips, solutions--always with a smile and a great sense of humor.You can find Chris in the Community and on LinkedIn. Thanks for being such a SUPER user, Chris! 💪 🌠  

Tuesday Tips: Community Ranks and YOU

TUESDAY TIPS are our way of communicating helpful things we've learned or shared that have helped members of the Community. Whether you're just getting started or you're a seasoned pro, Tuesday Tips will help you know where to go, what to look for, and navigate your way through the ever-growing--and ever-changing--world of the Power Platform Community! We cover basics about the Community, provide a few "insider tips" to make your experience even better, and share best practices gleaned from our most active community members and Super Users.   With so many new Community members joining us each week, we'll also review a few of our "best practices" so you know just "how" the Community works, so make sure to watch the News & Announcements each week for the latest and greatest Tuesday Tips!This Week: Community Ranks--Moving from "Member" to "Community Champion"   Have you ever wondered how your fellow community members ascend the ranks within our community? What sets apart an Advocate from a Helper, or a Solution Sage from a Community Champion? In today’s #TuesdayTip, we’re unveiling the secrets and sharing tips to help YOU elevate your ranking—and why it matters to our vibrant communities. Community ranks serve as a window into a member’s role and activity. They celebrate your accomplishments and reveal whether someone has been actively contributing and assisting others. For instance, a Super User is someone who has been exceptionally helpful and engaged. Some ranks even come with special permissions, especially those related to community management. As you actively participate—whether by creating new topics, providing solutions, or earning kudos—your rank can climb. Each time you achieve a new rank, you’ll receive an email notification. Look out for the icon and rank name displayed next to your username—it’s a badge of honor! Fun fact: Your Community Engagement Team keeps an eye on these ranks, recognizing the most passionate and active community members. So shine brightly with valuable content, and you might just earn well-deserved recognition! Where can you see someone’s rank? When viewing a post, you’ll find a member’s rank to the left of their name.Click on a username to explore their profile, where their rank is prominently displayed. What about the ranks themselves? New members start as New Members, progressing to Regular Visitors, and then Frequent Visitors.Beyond that, we have a categorized system: Kudo Ranks: Earned through kudos (teal icons).Post Ranks: Based on your posts (purple icons).Solution Ranks: Reflecting your solutions (green icons).Combo Ranks: These orange icons combine kudos, solutions, and posts. The top ranks have unique names, making your journey even more exciting! So dive in, collect those kudos, share solutions, and let’s see how high you can rank!  🌟 🚀   Check out the Using the Community boards in each of the communities for more helpful information!  Power Apps, Power Automate, Copilot Studio & Power Pages

Find Out What Makes Super Users So Super

We know many of you visit the Power Platform Communities to ask questions and receive answers. But do you know that many of our best answers and solutions come from Community members who are super active, helping anyone who needs a little help getting unstuck with Business Applications products? We call these dedicated Community members Super Users because they are the real heroes in the Community, willing to jump in whenever they can to help! Maybe you've encountered them yourself and they've solved some of your biggest questions. Have you ever wondered, "Why?"We interviewed several of our Super Users to understand what drives them to help in the Community--and discover the difference it has made in their lives as well! Take a look in our gallery today: What Motivates a Super User? - Power Platform Community (microsoft.com)

Users online (5,814)