cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Vaibhav_k
Resolver III
Resolver III

Patch to create item in another list

Dear community, when I open the list item in edit mode and click on create item icon in SharePoint list item, an item should get created in another list with same values some of them are choice, multiline text, lookup and person field. Is it possible to use patch function here to create new item and update if item already exists? Many thanks.

2 ACCEPTED SOLUTIONS

Accepted Solutions

I think I should use power automate to create item if it doesn't exist and modify if exists.

View solution in original post

Vaibhav_k
Resolver III
Resolver III

Simply Used powerautomate to create item if doesn't exist. Else updating if exists. 

View solution in original post

4 REPLIES 4
Drrickryp
Super User
Super User

@Vaibhav_k 

You can use the OnSuccess property of the form to do the patch.  However you have to have a field in the second list that matches the ID of the current list.  So if there is a field in list2 that is ParentID, then 

 

 

If(IsBlank(LookUp(List2,parentID=Form1.LastSubmit.ID),
   Patch(yoursecondlist, Defaults(yoursecondlist),{parentID:Form1.LastSubmit.ID
                                                   field1:Form1.LastSubmit.Field1, 
                                                   field2:Form1.LastSubmit.Field2,...}),
   Patch(yoursecondlist,parentID=Form1.LastSubmit.ID,{field1:Form1.LastSubmit.Field1, 
                                                     field2:Form1.LastSubmit.Field2,...}),

 

 

There are lot of errors I get in this formula after replacing actual list names and field names. Seems This is a pseudo code.

I think I should use power automate to create item if it doesn't exist and modify if exists.

Vaibhav_k
Resolver III
Resolver III

Simply Used powerautomate to create item if doesn't exist. Else updating if exists. 

Helpful resources

Announcements
Power Apps News & Annoucements carousel

Power Apps News & Announcements

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

Community Call Conversations

Introducing the Community Calls Conversations

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

Power Apps Community Blog Carousel

Power Apps Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (5,748)