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 Apps
Unanswered

UpdateIf Formula

(0) ShareShare
ReportReport
Posted on by 5,331 Moderator

I am using the following to update data in a SharePoint list from a PA Edit form.

Is this an all of nothing process, if you change one field do you have to account for all the form fields and overwrite data that remains the same merely because to not include all fields may leave some of the SP list columns blank for the item where data once was?

Is there a formula that says if any of the form fields change only update data associated with those field on the list, and leave all other data associated with that line item as is?

UpdateIf(
SharePoinList, EmployeeEmail = DataCardValue14.Text,
{EmployeeName: DataCardValue12.Text,
EmployeeEmail: DataCardValue14.Text,
Department: DataCardValue13.Text,
SupervisorName: DataCardValue20.Text,
SupervisorEmail: DataCardValue15.Text,
MainTopic: DataCardValue16.Text,
DateOfRequest: DataCardValue18.SelectedDate,
ResponseDueDate: DataCardValue26.SelectedDate,
'In-ProcessDate': DataCardValue23.SelectedDate,
CompleteDate: DataCardValue24.SelectedDate,
RequestStatus: DataCardValue25.Selected,
Notes: DataCardValue19.Text}
);

Categories:
I have the same question (0)
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Phineas 

    All of what you are asking would be handled by the SubmitForm function.  Why are you using UpdateIf for a Form?

  • Phineas Profile Picture
    5,331 Moderator on at

    Yep; I originally tried a SubmitForm and got an error. Maybe I had it constructed wrong. 

    SubmitForm(NewRequestForm);

     

    Error Message: The requested is invalid. Server Response: SharePointList failed: Object must implement IConvertible.....

    When I use Patch it all works fine.

  • PaulD1 Profile Picture
    2,914 on at

    I would avoid UpdateIf on the basis that it is not delegable. Instead I would use Patch with the syntax that updates a record:

    Patch(

    SharePoinList, LookUp(SharePointList, EmployeeEmail = DataCardValue14.Text),

    {EmployeeName: DataCardValue12.Text,
    EmployeeEmail: DataCardValue14.Text})

     

    I am assuming that you only actually want to update a single record? If you want to update more records with a Patch you can do a ForAll on a Filter that returns the records then iterate through them. Note that there is no concept of wrapping this up in a single 'transaction' such that either all succeed or none succeed - i.e. you may end up with only some patches succeeding.

     

    I would also strongly recommend naming your controls - it makes reading and debugging your formulas much easier.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Phineas 

    It is kind of a waste of a feature - a form has a lot of functionality that is available with it.  Using a Patch for it completely wastes all of those features.

    So, I would first investigate why they SubmitForm does not work.  That will eliminate all the patching and updating and all the extra work you are making for yourself.

     

    Tell me more about the error with the SubmitForm.  This would indicate that one of your Update properties on one of your datacards is not set properly.

     

    There is no need to change your controls or perform other elaborate formulas to do what you are trying.  Only SubmitForm is needed for everything you have there.

  • Phineas Profile Picture
    5,331 Moderator on at

    Ok, I have two forms.
    Form 2 (Edit form, not shown): I've changed the Patch to SubmitForm(List).
    There is no error when I submit the form and the data I've changed did update.

    The Form 1 (New form, see below) is the initial support request form. When I use Patch it worked fine.

    When I use SubmitForm(FormName) I get the '...IConvertible...' error message.

    I've checked all of the Datacard Update properties, they'll all point to the DataCardValue within.
    Phineas_0-1648569657744.png

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Phineas 

    Although they might refer to the controls in the datacard, the result those provide might not be accurate.

     

    Let's first focus on the ones that are obvious:

    - What kind of column is "Request Topic" in your list and what is the Update property of that datacard as well as the Items property of the dropdown control in that datacard?

    - What kind of column is "Request Status" in your list and what is the Update property of that datacard as well as the Items property of the dropdown control in that datacard?

     

    Then we'll go a little deeper based on assumptions:

    - The two date columns in your form...they are date type columns in your list?? And the Update property of the datacard refers to the SelectedDate property of the Date Picker control?

    - All the rest of the column types are text?

     

    Fill in the invalid statements/assumptions.

  • Phineas Profile Picture
    5,331 Moderator on at

     

    Edited Portion********************************This is a screenshot of the Notes column in the SP list.

    Phineas_0-1648573603212.png

    *********************************************************************

    Please see below....

     

    - What kind of column is "Request Topic" in your list – Single line of text


    - What is the Update property of that datacard – DataCardValue1-2.SelectedText


    - What is the Items property of the dropdown control in that datacard – Hardcoded as such…
                           ["Choose Topic","Bill of Materials","Compliance"]

     

    - What kind of column is "Request Status" in your list – Choice

     

    - What is the Update property of that datacard – I’ve tried both .Selected.Value and .SelectedText


    - What is the Items property of the dropdown control in that datacard – Hardcoded as such…
                           ["New","In-Process","Complete"]

     

    - The two date columns in your form...they are date type columns in your list - Yes, ALL date columns are Date and Time type in SP list

    - The Update property of the date field datacards refer to the .SelectedDate property of the Date Picker control - Yes, ALL date columns are Date and Time type in SP list

    - All the rest of the column types are text – Notes is Multiple lines of text type

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @Phineas 

    So first (and not related to an error), change all the SelectedText properties to Selected.Value  SelectedText is a property that has been deprecated and should be avoided.

     

    So, change that on the Request Topic Update property.

     

    For the Request Status Update property, change it to JUST  .Selected

    You need to provide a record with a Value column for your choice column.  If you use .Selected (based on your current Items property for that control), it will be a record with a Value column...just what you need.

     

    The rest all looks fine.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 633

#2
11manish Profile Picture

11manish 588

#3
Valantis Profile Picture

Valantis 457

Last 30 days Overall leaderboard