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:
Edit Mode:
My Configuration:
EditScreen1> EditForm1:
What works/what doesn't:
Create Mode:
Edit Mode:
Any suggestions would be appreciated.
TIA
Steve
Solved! Go to Solution.
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
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
Hi Sik,
Thanks for that - Create mode is working perfectly now.
However, Edit Mode isn't quite right:
Edit Mode:
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
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
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
User | Count |
---|---|
251 | |
250 | |
82 | |
45 | |
29 |
User | Count |
---|---|
345 | |
262 | |
122 | |
64 | |
58 |