web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Add new or edit existi...
Power Apps
Answered

Add new or edit existing SP list item

(0) ShareShare
ReportReport
Posted on by 47

Hi All

What is the easiest way to update Sharepoint list item (if it exists) or add (if dont exist). 
So I have a list with columns TempId and Data, and I have some data {TempId:23, Data:"Some Data"}, and I want to check if the item with TempId exist, and, if exists, update its Data, or, if not exists, create new item with TempId 23 and Data "Some Data".

Thanks

     

Categories:
I have the same question (0)
  • zmansuri Profile Picture
    6,048 Super User 2024 Season 1 on at

    PowerApps Duplicates - Avoid, highlight, and even delete - YouTube

     

    This will help

  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @romankorchak1 ,

     

    Something like below code will work in your case. Please update according to your data source and controls.

     

    If( IsBlank(Lookup(DataSource,TempId =23).ID),
    
    Patch(DataSource, Defaults(DataSource),{
    TempId:23, 
    Data:"Some Data"
    }
    ),
    UpdateIf(DataSource,Lookup(DataSource,TempId =23).ID,{
    TempId:23, 
    Data:"Some Data"
    })
    
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Verified answer
    v-qiaqi@microsoft.com Profile Picture
    Microsoft Employee on at

    Hi @romankorchak1,

    Have you solved your problem?

    Do you want to check if a special id existing in the SP list and update it?

    Could you please tell me if these columns are Text type?

    1). Add a TextInput to input your special dynamically TempId, set its OnChange property as below:

    If(IsBlank(LookUp(Product,TempId=TextInput14.Text)),NewForm(Form3),EditForm(Form3))

    2). Add a Form and set the Item based on the TempId, if it exists, make it an edit form, if it not exits, make it a new form.

    Set Form Item as below:

    LookUp(Product,TempId=TextInput14.Text)

    3). Add a submit button and set OnSelect as below:

    SubmitForm(Form3)

    Note that this solution helps you fill in dynamic TempId and update data dynamically.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 414

#2
Valantis Profile Picture

Valantis 387

#3
timl Profile Picture

timl 344 Super User 2026 Season 1

Last 30 days Overall leaderboard