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

Update existing or create a new SharePoint item via Form entry

Good Morning all.

 

I have a Form that includes the following information.  Date, Office, Loaction, Manager, Model, Serial and Asset

 

The Form needs to update a SharePoint list.  If the Asset is not currenty recorded a new item should be added to the list.  If the asset is there already then that item should be updated.  The Date, Office, Location and Manager are able to change while the Asset, Model and Serial number would always stay the same.

 

I have tried to build a Flow that will collect the form data, reference the SharePoint site and either update the existing record based on Asset or add a new entry.  

 

Can anyone help me with a reccomendation on a flow to use?  I would think something like this would be rather common but can not find any examples...

 

Thank you,

Adam

1 ACCEPTED SOLUTION

Accepted Solutions
v-yamao-msft
Community Support
Community Support

Hi @AdamWeinstein ,

 

Do you want to create a new item in SharePoint list if it doesn’t exist, otherwise, update the existing item?

 

I have created the following flow for your reference. In my scenario, name from Forms has common value with Title from the list, and would always stay the same.

 

  • Add the trigger When a response is submitted.
  • Initialize an Array variable named as Test.
  • Add action Get response details, an Apply to each will be added automatically.
  • Get items from the list.
  • Add an Apply to each 2, select value from Get items, then add action Append to array within the apply to each 2, select Title for the Value field.
  • Under Apply to each 2, add a Condition to check if the variable Test contains name from the trigger.
  • If yes, add Condition 2 to check if Title is equal to Name, then add action Update item under If yes branch of Condition 2.
  • If no, create an item in the list with corresponding value from the form.

 

2.PNG3.PNG

 

Best regards,

Mabel

 

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

View solution in original post

6 REPLIES 6
v-yamao-msft
Community Support
Community Support

Hi @AdamWeinstein ,

 

Do you want to create a new item in SharePoint list if it doesn’t exist, otherwise, update the existing item?

 

I have created the following flow for your reference. In my scenario, name from Forms has common value with Title from the list, and would always stay the same.

 

  • Add the trigger When a response is submitted.
  • Initialize an Array variable named as Test.
  • Add action Get response details, an Apply to each will be added automatically.
  • Get items from the list.
  • Add an Apply to each 2, select value from Get items, then add action Append to array within the apply to each 2, select Title for the Value field.
  • Under Apply to each 2, add a Condition to check if the variable Test contains name from the trigger.
  • If yes, add Condition 2 to check if Title is equal to Name, then add action Update item under If yes branch of Condition 2.
  • If no, create an item in the list with corresponding value from the form.

 

2.PNG3.PNG

 

Best regards,

Mabel

 

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

Hello,

 

With a few minor tweaks we got it to work as needed.  This might be a useful template for people that want to use a form to create or update an item on a list. 

 

Thank you again,

Adam

Hi Adam,

 

Did you use a SharePoint list as a source for this? If yes, can you please share the logic or screenshots of the workflow? I am trying to achieve the same and have some issues.

 

Thanks,

 

Santosh

GarethReeves
Frequent Visitor

I am not sure this works anymore, The first "Apply to each" the output "list of responses" is no longer an option. Is this a bug or a change? if so is there an updated method for updating an existing list library from a form submission?

thanks

Hi,

In this flow for "Get Items" what should be mentioned in Filter Querry?, as it can't be left blank.

 

Facing same issue

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (2,259)