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 / Something wrong with I...
Power Apps
Answered

Something wrong with If-statement when patching people field to SharePoint

(0) ShareShare
ReportReport
Posted on by 50

Hi,

I've been going over this for a while now and it's driving me crazy

My best guess is that there is something I'm doing wrong with my If-statements here.

 

Scenario: I have a SP-list with two people/person field inside it.

In powerapps I show that list in a gallery and you can navigate to each single record on a screen to make edits to it.

 

After you make edits and hit the save icon it runs a collection, then it Patches that collection with ShowColumns.

 

However, everytime I have to make changes to both of the person fields to make any changes go through.

For instance if you add one name at one point and then go back to it you cant just add the other name, you have to delete the already added name, add it again and then add the new one. Otherwise it wont go through.

Same thing happens if you have two names and you wish to delete one of them, you have to delete both names and add the one you want to keep in order to delete the one name.

 

My best guess here is that there is something wrong with my If-statments in the collection

ClearCollect(
 LVToNew3,
 {
 RN: If(
 IsBlank(CBRegion.Selected.DisplayName),
 Blank(),
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & CBRegion.Selected.Mail,
 Department: "",
 DisplayName: CBRegion.Selected.DisplayName,
 Email: CBRegion.Selected.Mail,
 JobTitle: "",
 Picture: ""
 }
 ),
 Ansvarig: If(
 IsBlank(CBRegion_1.Selected.DisplayName),
 Blank(),
 {
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
 Claims: "i:0#.f|membership|" & CBRegion_1.Selected.Mail,
 Department: "",
 DisplayName: CBRegion.Selected.DisplayName,
 Email: CBRegion_1.Selected.Mail,
 JobTitle: "",
 Picture: ""
 }
 ),
 Telnr: TextInput3.Text,
 Regi: TextInput3_1.Text,
 Ansvar: TextInput3_2.Text,
 Epost: TextInput3_3.Text,
 ID: varLV.ID
 }
);
Patch(
 Lokalvard,
 ShowColumns(
 LVToNew3,
 "RN",
 "Ansvarig",
 "Telnr",
 "Regi",
 "Ansvar",
 "Epost",
 "ID"
 )
)

 

I have Formula lever error managment turned on, so I can patch Blank, but only if I make changes to both of the person fields.

Can anyone tell me what I'm doing wrong here?

 

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @drwaz 

     

    Nothing is wrong with your formula and Formula lever error management is required to set blank as you did.

     

    I tried the same scenario. Looks to me like this is a bug, I tried multiple ways

    • Using Office365Users, Choices(SpName.PersonColumn)
    • Patch and submit the form
    • Patch User one by one
    • Patch other data and User

    All are having the same problem. FYI, '@odata.type' line is not required going forward.

     

    I recommend creating an MS ticket to confirm this bug or is missing anything.

     

    StalinPonnusamy_0-1635774521849.png

     


    Thanks,
    Stalin - Learn To Illuminate

  • drwaz Profile Picture
    50 on at

    Thanks for looking into it, I was statring to suspect its a bug. But I'll create a ticket and see if I can learn more

    Thanks again!

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 610

#2
Haque Profile Picture

Haque 317

#3
WarrenBelz Profile Picture

WarrenBelz 315 Most Valuable Professional

Last 30 days Overall leaderboard