cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

SharePoint Item is Created -> Update Item

I have five (let's call them lists A-F) SharePoint lists that users will fill out daily. I also have a separate list (let's call it list x) that I have a Flow setup for that creates each of those lists A-F as items, daily, and sets them to incomplete (choice of complete or incomplete as one of the columns). This will serve as daily task list for the users who fill out the lists.

 

I'm trying to have a Flow so if a new item on lists A-F is created, I want to update list X (change the appropriate item from incomplete to complete).

 

However, the IDs, a required field, do not match between lists A-F and list X so I get a "Could not find list item" error. I don't really want to match their IDs. I just want to check if a new item is created with today's date on lists A-F, then I want to update list X's corresponding item from incomplete to complete. Below is a screenshot of list X. I've enabled the ID column for troubleshooting.

 

 

This is the daily task list, aka List XThis is the daily task list, aka List X

Current flow that fails because IDs don't matchCurrent flow that fails because IDs don't match

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @kristof805,

 

If you remember from my first response to your post, I suggested to use a column as your UniqueID to identify the items between the lists. I took a different approach and this is what I came up with. For the Flow that creates the items in the Daily List, I am using the Title column as my unique ID, and the value I set to this column is this: 

concat('ListA-',formatDateTime(utcNow(),'yyyyMMdd'))

I am concatenating the name of one of the lists, which in the example above is ListA, then I take the utcNow() and format it to yyyyMMdd, which outputs the date as "20171012". The Date field is set by taking the utcNow() and format it to output the date as "10/12/2017". As for the remaining fields, I set the Task Value to the pertaining task and the Status to "Incomplete".

formatDateTime(utcNow(),'MM/dd/yyyy')

The screenshot below shows one of the steps to create the items in the Daily List.
CreateUpdateItem-1.PNG

 

Now onto the item creation in the other lists. The first step on the Flow is update the Title column in the item right after is created. The value of the Title column will be set to the same value used in the Recurrence Flow above. It will concatenate the name of the list, followed by today's date, which is obtained from the formatted utcNow(). This Title column will help with matching the correct item in the Daily List. See the code and screenshot below:

concat('ListA-',formatDateTime(utcNow(),'yyyyMMdd'))

CreateUpdateItem-2.PNG

Here comes the interesting part. In the next step, I am using the Get items to get all the items from the Daily List, but in it I am using the Filter Query to get any items which Title is equals to the Title column from the Update item step in the screenshot above.
CreateUpdateItem-3.PNG

After the Get items step then a Condition needs to run to see if there's an item in the Daily List with the same Title as the item in the other lists, which in my example is "ListA". In order to enter this condition, you have to edit it in advanced mode. The Condition will check if the length of the number of items retrieved from the Get items step is 1 (1 is true, 0 is false). See the Condition below:

@equals(length(body('Get_items')?['value']), 1)

 CreateUpdateItem-4.PNG

If the Condition returns false, nothing happens and the Flow stops, but if it returns true, then the Flow updates the matching item in the Daily List by setting the Status to Complete.
CreateUpdateItem-5.PNG

 

If you can, give this approach a try and see if it works. Please let me know if you have any questions.

 

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!

View solution in original post

21 REPLIES 21
faustocapellanj
Memorable Member
Memorable Member

Hi @kristof805,

 

If you are talking about the ID column that comes out of the box in SharePoint lists, that will not work. You will need a unique identifier such as the Title column or a custom one you create.

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 thanks for the reply. I'm a pretty big SharePoint and Flow newbie. Can you recommend a method on how I can make a unique identifier? I've disabled the Title column as I was not using it (it's hidden on both the list and when you enter a new list item). 

Hi @kristof805,

 

Before I proceed, please clear something up for me. The users go to lists A-F and every item created in these lists are also created in list X. Is that a true statement? And once these items are in both lists, where do users go to update the items are complete: list x or lists A-F?

 

Thanks,

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!

The way it should work is this way: on list X a Flow creates an item for each list A-F and sets it to incomplete. This happens once a day. When people go to list A, B, C, D, E or F and create a daily item, that Flow should then go to list X, find the corresponding item and change the status to complete. If a user added an item on list A, list X's item A for that day should be changed from incomplete to complete. If a user fills out an item for list B, list X's item B should be changed from incomplete to complete.

 

To answer your question, the users only update lists A-F and should not be interacting with list X. The item they fill out in lists A-F is not an exact copy on list X. The list X corresponding item is just the list name as an item (list A, B, etc) with today's date and its status (incomplete/complete). Lists A-F actually contain the information.

@kristof805

 

Another question: the List X items are being created thru a scheduled flow or manually?

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

Scheduled Flow that happens every day at 12:01AM (right after midnight). This works.

v-xida-msft
Community Support
Community Support

Hi @kristof805,

 

Do you want to create a flow that is used to update corresponding item in ListX for each of Lists A-F?

Is there a column which stores the list’s name in the ListX? Which type of that column?

Further, if multiple users create items in one of Lists A-F, how do you want to update the corresponding item in ListX?

I suppose that there is text column which stores the list’s name in the ListX. Please take a try with the following workaround:2.JPG

 

 

 

3.JPG

 

4.JPG

Within “Apply to each”, add a Condition, click “Edit in advance mode”, type the following formula:

@and(equals(item()?['ListName'],'ListA'),equals(formatDateTime(item()?['Date'],'MM/dd/yyyy'),utcnow('MM/dd/yyyy')))

 The flow works successfully as below:

 

5.JPG

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi @kristof805,

 

Can you please post a screenshot of the scheduled flow step so I can replicate?

 

Thanks.

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

@v-xida-msft thanks for that Flow! I think I am really close to getting it to work. Currently it executes but all the conditions that are met are false. It loops 12 times, which is the current number of items on list X aka Daily Lists (that's the actual name of the list on my SP).

 

Flow1.png

 

Right now I'm trying different combinations in your syntax. I'm assuming you are supposed to replace both ListName and ListA? Should ListName be replaced by Daily Lists? Should the item I'm trying to find in Daily Lists be replaced in your code where it says ListA?

 

Here is your original code:

 

 

@@and(equals(item()?['ListName'],'ListA'),equals(formatDateTime(item()?['Date'],'MM/dd/yyyy'),utcnow('MM/dd/yyyy'))

Here are the things I've tried and failed so far (Alarm & Vent Log is a SharePoint list (list A-F) and an item on Daily Lists:

 

@and(equals(item()?['Daily Lists'],'Alarm & Vent Log'),equals(formatDateTime(item()?['Date'],'MM/dd/yyyy'),utcnow('MM/dd/yyyy')))
@and(equals(item()?['ListName'],'Alarm & Vent Log'),equals(formatDateTime(item()?['Date'],'MM/dd/yyyy'),utcnow('MM/dd/yyyy')))

 

Everything currently comes back as false so I'm guessing somehow the match between the item creatin's list and Daily Lists is not getting matched, therefore, incomplete is not getting changed to complete for the item (we can see that it never gets to the If Yes part of the flow since everything results in a false result.

 

Do you have any links where I can read up on the formatting / syntax of the above code?

 

 

 

@faustocapellanj please see attached: 

 

Flow2.png

Hi @kristof805,

 

If you remember from my first response to your post, I suggested to use a column as your UniqueID to identify the items between the lists. I took a different approach and this is what I came up with. For the Flow that creates the items in the Daily List, I am using the Title column as my unique ID, and the value I set to this column is this: 

concat('ListA-',formatDateTime(utcNow(),'yyyyMMdd'))

I am concatenating the name of one of the lists, which in the example above is ListA, then I take the utcNow() and format it to yyyyMMdd, which outputs the date as "20171012". The Date field is set by taking the utcNow() and format it to output the date as "10/12/2017". As for the remaining fields, I set the Task Value to the pertaining task and the Status to "Incomplete".

formatDateTime(utcNow(),'MM/dd/yyyy')

The screenshot below shows one of the steps to create the items in the Daily List.
CreateUpdateItem-1.PNG

 

Now onto the item creation in the other lists. The first step on the Flow is update the Title column in the item right after is created. The value of the Title column will be set to the same value used in the Recurrence Flow above. It will concatenate the name of the list, followed by today's date, which is obtained from the formatted utcNow(). This Title column will help with matching the correct item in the Daily List. See the code and screenshot below:

concat('ListA-',formatDateTime(utcNow(),'yyyyMMdd'))

CreateUpdateItem-2.PNG

Here comes the interesting part. In the next step, I am using the Get items to get all the items from the Daily List, but in it I am using the Filter Query to get any items which Title is equals to the Title column from the Update item step in the screenshot above.
CreateUpdateItem-3.PNG

After the Get items step then a Condition needs to run to see if there's an item in the Daily List with the same Title as the item in the other lists, which in my example is "ListA". In order to enter this condition, you have to edit it in advanced mode. The Condition will check if the length of the number of items retrieved from the Get items step is 1 (1 is true, 0 is false). See the Condition below:

@equals(length(body('Get_items')?['value']), 1)

 CreateUpdateItem-4.PNG

If the Condition returns false, nothing happens and the Flow stops, but if it returns true, then the Flow updates the matching item in the Daily List by setting the Status to Complete.
CreateUpdateItem-5.PNG

 

If you can, give this approach a try and see if it works. Please let me know if you have any questions.

 

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!

@faustocapellanj thank you for the detailed write up. I will try this on Monday and get back to you. Thank you again!

Hey @faustocapellanj !

 

Sorry for the long wait but I was finally able to put this together on my end and.. it didn't work (do these things every JUST work)?

 

This is the step it got stuck at.This is the step it got stuck at.

So it failed on the Get items phase. I'll post a screenshot below. I can try populating the Filter Query from the When an item is created dynamic content.

 

I got the Title from Update Item part of the Dynamic contentI got the Title from Update Item part of the Dynamic content

Also, one problem I am going to run into this is your second action in the Flow is Update Item. While that step executed properly, I have about 10 fields people will fill out when filling out ListA. Once they hit submit and the Flow starts, the Update Item phase overwrites the fields because those fields are required to be filled out by the employees but that makes it a requirement for them to be filled out by Flow too.

 

I verified this and saw on ListA that the last time it was modified was identical to when the Flow ran and completed the second step.

 

Let me know if you find something wrong with my Step 3 or can think of a way to solve this problem (overwriting newly filed item on ListA).

 

I do love the "ListA-10192017" unique ID solution. I hope we can make it work. I'll be tinkering with it too.

 

Cheers,

Kristof

Hi @kristof805,

 

The purpose of the Update item step is to set the item Title field in ListA, but if you can find another way to set its value, you can do it outside of Flow; this will keep your fields from being overwritten. But if you need to do it from within Flow, just grab the fields value from your trigger step I just did it in Flow to maintain consistency with the naming convention from the Daily List. Now, on your Get items step, your Filter Query is wrong. You have to type the name of the column followed by eq and then followed by the name of the column available in the dynamic content. Check out the marked area in the screenshot below for my Get items step.
CreateUpdateItem-3.1.PNG

 

Please let me know if you have any questions.

 

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!

@faustocapellanj here is an update for you:

 

So, I took out the Update Item step since I can autofill the Title column on ListA when a new item is created by setting it up w/ a Calculated value by default:

 

=CONCATENATE("Pressure-",TEXT(NOW(),"yyyyMMdd"))

Although this gave me Pressure-20171020 yesterday at 5pm when it was still 10/19/2017 (US date format for October 19th) which is off by a day, I think I can fix this part fairly easy.

 

Onto the problem, the Flow is now failing at the Get items step:

Failed step and messageFailed step and messageSyntax of the step, copying what you said to putSyntax of the step, copying what you said to put

So the Get items step gets the Title (dynamic content) from When an item is created and that comes up with the correct result, as seen on the screenshot: "Pressure-20171020". However, the front part doesn't execute it just leaves the word "Title eq".

 

What am I missing?

 

Hi @kristof805,

 

You are missing the single quotes around the Title coming from the dynamic content. See the below screenshot for the single quotes. They are really easy to miss. CreateUpdateItem-3.1.PNG

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 progress!

 

Okay so it got to the condition but it returned false, which I hate, since there is nothing to investigate:

Progress??Progress??

Behind the pop-out is "is equal to" and 1Behind the pop-out is "is equal to" and 1

I hate troubleshooting this specific part since it doesn't show the code that's execute for it to return false.

 

Quick update: Also I can click Edit in advanced mode and the code is still the same as you provided:

@equals(length(body('Get_items')?['value']), 1)

Hi @kristof805,

 

At least the flow is not failing. Question: are you naming the item in the Daily List the same as the item in ListA?

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

The Daily List has items which are identical to the names of the SharePoint lists that get filled out each day, yes. I don't really name the item, just the list. Each new item created on ListA now does have the ID, for today for ListA, Pressure-20171020.

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 (897)