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 / Windows365Users Defaul...
Power Apps
Answered

Windows365Users Default User / SP List

(0) ShareShare
ReportReport
Posted on by 14

Hi Guys,

 

I have a SP List with a column 'Person' having the Datatype Person. I recently got some help on this forum as to how to write Windows365User records to the List and this works fine. This App was built using the 'Start from data' method with the SP List as the starting point. I have also added the 'Windows 365 Users' data source to the App.

 

This is how I would like the App to behave:

 

Create Mode:

  • The Person field defaults to the logged in User. If the User submits the form, the User is written to the List.
  • The logged in User can override them self with any other User from the Windows365Users combo list. When the User submits the form, the override User is written to the List.

Edit Mode:

  • The Person field is populated with the User extracted from the List. The logged in User can update any fields and if they leave the extracted User as-is, the List value is left unchanged after a Submit.
  • The logged in User can override the List User with them self or any other User from the Windows365Users combo list. The updated User is written to the SP List.

 

My Configuration:

EditScreen1> EditForm1:

  • Person_DataCard2:
    • Advanced:
      • Default: ThisItem.Person
      • Update:
        • If(EditForm1.Mode = FormMode.New,{
              DisplayName:User().FullName,
              Claims:"i:0#.f|membership|" & Lower(User().Email),
              Department:"",
              Email:User().Email,
              JobTitle:"",
              Picture:""
          },DataCardValue4.Selected)
    • DataCardValue4:
      • Advanced:
        • Items:
          • Microsoft365Users.SearchUser({searchTerm : "", top:999})
        • DefaultSelectedItems:
          • If(EditForm1.Mode = FormMode.New, {
                DisplayName:User().FullName,
                Claims:"i:0#.f|membership|" & Lower(User().Email),
                Department:"",
                Email:User().Email,
                JobTitle:"",
                Picture:""
            }, ThisItem.Person)

What works/what doesn't:

 

Create Mode:

  • The Person field defaults to the logged in User. If the User submits the form, the User is written to the List.
    • Good
  • The logged in User can override them self with any other User from the Windows365Users combo list. If the User submits the form, the override User is written to the List.
    • FAIL: An override User can be chosen from the combo list but, after it has been submitted, the logged in User is stored rather than the override.

Edit Mode:

  • The Person field contains the User extracted from the List. The User can update any fields and if they leave the extracted User as-is, the List value is left unchanged after a Submit.
    • GOOD
  • The logged in User can override the List User with them self or any other User from the Windows365Users combo list. The updated User is written to the SP List.
    • FAIL: Regardless of what User is chosen to override the stored value, the stored value is not updated.

Any suggestions would be appreciated.

 

TIA

 

Steve

 

Categories:
I have the same question (0)
  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @SteveRoach ,

     

     

    The issue is caused that the login user is hard coded in Update property of data card so it always saves the login user to SP list.

    The workaround is to modify the Update property as follows.

    {
     DisplayName:DataCardValue4.Selected.DisplayName,
     Claims:"i:0#.f|membership|" & DataCardValue4.Selected.UserPrincipalName,
     Department:"",
     Email:DataCardValue4.Selected.UserPrincipalName,
     JobTitle:"",
     Picture:""
    }

     

    Beyond that, I would recommend you modify the DefaultSelectedItems as follows.

    If(
    EditForm1.Mode = FormMode.New,
    LookUp(Microsoft365Users.SearchUser({searchTerm : "", top:999}), UserPrincipalName=User().Email),
    LookUp(Microsoft365Users.SearchUser({searchTerm : "", top:999}), UserPrincipalName=ThisItem.Person.Email)
    )

    Hope this helps.

    Sik

  • SteveRoach Profile Picture
    14 on at

    Hi Sik,

     

    Thanks for that - Create mode is working perfectly now.

     

    However, Edit Mode isn't quite right:

     

    Edit Mode:

    • The Person field contains the User extracted from the List. The User can update any fields and if they leave the extracted User as-is, the List value is left unchanged after a Submit.
      • GOOD
    • The logged in User can override the List User with them self or any other User from the Windows365Users combo list. The updated User is written to the SP List.
      • FAIL: Regardless of what User is chosen to override the stored value, the stored value is not updated.

     

    I have changed the DefaultSelectedItems, as you suggested, to:

     

    If(
    EditForm1.Mode = FormMode.New,
    LookUp(Microsoft365Users.SearchUser({searchTerm : "", top:999}), UserPrincipalName=User().Email),
    LookUp(Microsoft365Users.SearchUser({searchTerm : "", top:999}), UserPrincipalName=ThisItem.Person.Email)
    )

     

    It appears that the second part of this If statement (where EditForm1.Mode is not FormMode.New) isn't picking up that I have changed the field. Or, if it has, it isn't searching the Microsoft365Users list for the change.

     

    Any ideas?

     

    Cheers

     

    Steve

  • v-siky-msft Profile Picture
    Microsoft Employee on at

    Hi @SteveRoach ,

     

    The issue sounds like a error in Update property. 

    Did you put my code in the original If logic? If so, it is not necessary, please put the following code to Update property directly. Whatever the form is to create or edit, the person to update is always from the DataCardValue4.

    {
     DisplayName:DataCardValue4.Selected.DisplayName,
     Claims:"i:0#.f|membership|" & DataCardValue4.Selected.UserPrincipalName,
     Department:"",
     Email:DataCardValue4.Selected.UserPrincipalName,
     JobTitle:"",
     Picture:""
    }

    The DefaultSelectedItems property code is to display the default person in combobox. if the form is in create mode, it shows LoginUser by default, if in edit mode, it shows the person extracted from the List. Hence, it doesn't do with this issue.

    Hope this helps.

    Sik

  • SteveRoach Profile Picture
    14 on at

    Hi Sik,

     

    Yes, that worked very well. My bad, I misinterpreted your first about the DataCardValue Update property. This all works as expected, thank you.

     

    Steve

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 Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 358 Most Valuable Professional

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard