cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mauvis99
Regular Visitor

Forms to Sharepoint List

Hi There,

 

I have a Flow that takes data from a Form and creates a Sharepoint list item. The form is a 'Working from home' form, so staff can fill in the days they are in the office or working from home.

 

When I run the form, the flow works where it creates a Sharepoint List Item with the Staff members Name, the Days (Mon - Friday) and what they've selected: For example:

Name: Joe Bloggs   Monday: Working from Home, Tuesday: In the office....... and so on.

 

The problem is the flow creates the first list item and keeps creating more list items if the user re-submits the form. Is there a way for the flow to check if there is already an entry for Joe Bloggs and simply update the day fields with the new data?

1 ACCEPTED SOLUTION

Accepted Solutions
mauvis99
Regular Visitor

Hi All,

 

Seems I figured out a way.

 

My Solution:

 

When a new response to My Form is received:

Get the response details

Get Items - My List from Sharepoint Lists

Create Item - from reponse Details

Create a condition - if 'Get Items ID' is Less than 'Create Items ID'

Delete Item - 'Get Items ID'

 

This means that the when the form is created, the response details are gathered, Get the current sharepoint details, check if the ID that is in the List is less than the Newly created ID, if it is less, delete the old ID's. Thanks for all your suggestions

 

View solution in original post

7 REPLIES 7
takolota
Power Participant
Power Participant

@mauvis99 

 

Yes, but some more information on the use case may be helpful.

 

If these are all staff logged into O365, then there should be a user email dynamic content saved in each response. Start saving that user email to a column in the list. Then in the flow use a SharePoint Get items action after the Get form response with an Odata filter in the Get items set to Email eq ‘Insert form user email dynamic content here’

 

Then you can use a condition with the expression length(values(‘Get_items’)) is greater than 0

With the Yes/True side set to Update item in the SP list to update an existing item and the No/False side set to Create item in the SP list.

 

From there you may need to adjust the Get items filter to your exact use case. For example, Are you only trying to check existing form responses for this week? Or is there some other data point on the form that identifies what week they are submitting for?

mauvis99
Regular Visitor

Hi there, thanks for the reply, yes, all staff are on O365, I noticed the response pulls in their email address. When I do a Get Item on the list there’s more details like their Full Name, modified date, submission time. So I was thinking if I can just get the flow to check for the Full name, if there’s a match just update details for that full name, don’t create a new entry. If there isn’t one already in the list, just create the list entry from the filled in form. I’ll try what you’ve suggested, thanks a lot!

mauvis99_0-1653018810691.png

mauvis99_1-1653018921801.png

 

Hi there, I've tried the above, but I find the exising item in my Sharepoint List is not being updated, am i doing it right?

takolota
Power Participant
Power Participant

@mauvis99 

 

No, you put ID in as the array to loop through in the Apply to each. That needs to be the body.

Or if you just make an update action & start filling it in with the ID from the Get items, it should create the correct loop for you automatically.

eliotcole
Super User
Super User

This isn't an answer (since I think you're on your way with @takolota ), and I'm not wishing to diminish any or all of the great work that you're both doing here, but could you not use Microsoft Teams' Shifts for a basic lodging of these shifts? 

 

I've only just looked at it for the first time, and it seems pretty easy to pick up, plus it would eschew the need to manage a list, and various logic processing elsewhere.

 

Plus, if needed, you can export the details elsewhere.

 

I just created Shifts details for one of my makeshift Teams on my own tenancy, and then created two Shifts Groups inside that Team's shift pattern. It isn't particularly complicated, and I might want to learn a bit more about it, but the basics are there.

 

There's also Power Automate flow triggers for shifts, too. Plus I've no doubt with the right poking around you could export that data wherever you liked!

Thank you!! I’ll definitely check this out! 

mauvis99
Regular Visitor

Hi All,

 

Seems I figured out a way.

 

My Solution:

 

When a new response to My Form is received:

Get the response details

Get Items - My List from Sharepoint Lists

Create Item - from reponse Details

Create a condition - if 'Get Items ID' is Less than 'Create Items ID'

Delete Item - 'Get Items ID'

 

This means that the when the form is created, the response details are gathered, Get the current sharepoint details, check if the ID that is in the List is less than the Newly created ID, if it is less, delete the old ID's. Thanks for all your suggestions

 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,123)