I have a new form. In order to save time I auto populate the fields for the person name and supervisor (both are SharePoint lists People or Group fields). In order to do so I selected the Data Card which is responsible for Employees Name and in default value I put the following formula:
Office365Users.MyProfile()
In the supervisors field I did the same thing and put the following formula:
Office365Users.Manager(Office365Users.MyProfile().UserPrincipalName)
It works and displays the employee name correctly as well as the supervisors name correctly. However it seems that it does not bind the Person item correctly to the field. Because if I launch the PowerApp and try to create a new record without changing the Employee field or Supervisor field I get the following error:
The requested operation is invalid. Server Response: A value must be provided for item.
However if I manually enter Employee Name and select from the drop down list and do the same for Supervisor it works as expected. So it seems that when I put the default value even though it is a People object it does not bind it correctly.
It is not a huge issue I can just make every employee manually find their name and their supervisors name, however it would be very nice if I could make this automation work. Has anyone had a similar issue and found a way to fix it? Thanks!
Here is the pic of the data card:
If I manually type into the field and then select an option from suggested options there is no error:
Solved! Go to Solution.
Hi @Anonymous,
I think the issue here should be related with Record mis-match.
SharePoint lookup fields (Like Choice, Lookup, and Person or group type) is considered as record type under PowerApps, you should be able to find the proper record elements by checking the lookup field advanced options:
It should be the following:
{'@odata.type':"#Microsoft.Azure.Connectors.Share
Claims:"i:0#.f|membership|michael@wiXXXX.onmicros
Department:"",
DisplayName:"Michael Shao",
Email:"Michael@wiXXXX.onmicrosoft.com",
JobTitle:"",
Picture:""
}
The Office365user.MyProfie() would give the following record elements:
Office365Users.MyProfile().Department
Office365Users.MyProfile().DisplayName
Office365Users.MyProfile().GivenName
Office365Users.MyProfile().Id
Office365Users.MyProfile().JobTitle
Office365Users.MyProfile().Mail
Office365Users.MyProfile().MailNickname
Office365Users.MyProfile().Surname
Office365Users.MyProfile().TelephoneNumber
Office365Users.MyProfile().UserPrincipalName
Office365Users.MyProfile().AccountEnabled
We could change the Default property with the corresponding record (People field), then replace the data with the following:
{'@odata.type':"#Microsoft.Azure.Connectors.Share
Claims:Concatenate("i:0#.f|membership|",Office365Users.MyProfile().Mail),
Department:Office365Users.MyProfile().Department,
DisplayName:Office365Users.MyProfile().DisplayName,
Email:Office365Users.MyProfile().Mail,
JobTitle:Office365Users.MyProfile().JobTitle,
Picture:""
}
Tested from my side, the corresponding user would be added without selection.
Let me know if this works in your side.
Regards,
Michael
Hi @Anonymous,
I think the issue here should be related with Record mis-match.
SharePoint lookup fields (Like Choice, Lookup, and Person or group type) is considered as record type under PowerApps, you should be able to find the proper record elements by checking the lookup field advanced options:
It should be the following:
{'@odata.type':"#Microsoft.Azure.Connectors.Share
Claims:"i:0#.f|membership|michael@wiXXXX.onmicros
Department:"",
DisplayName:"Michael Shao",
Email:"Michael@wiXXXX.onmicrosoft.com",
JobTitle:"",
Picture:""
}
The Office365user.MyProfie() would give the following record elements:
Office365Users.MyProfile().Department
Office365Users.MyProfile().DisplayName
Office365Users.MyProfile().GivenName
Office365Users.MyProfile().Id
Office365Users.MyProfile().JobTitle
Office365Users.MyProfile().Mail
Office365Users.MyProfile().MailNickname
Office365Users.MyProfile().Surname
Office365Users.MyProfile().TelephoneNumber
Office365Users.MyProfile().UserPrincipalName
Office365Users.MyProfile().AccountEnabled
We could change the Default property with the corresponding record (People field), then replace the data with the following:
{'@odata.type':"#Microsoft.Azure.Connectors.Share
Claims:Concatenate("i:0#.f|membership|",Office365Users.MyProfile().Mail),
Department:Office365Users.MyProfile().Department,
DisplayName:Office365Users.MyProfile().DisplayName,
Email:Office365Users.MyProfile().Mail,
JobTitle:Office365Users.MyProfile().JobTitle,
Picture:""
}
Tested from my side, the corresponding user would be added without selection.
Let me know if this works in your side.
Regards,
Michael
Thanks Michael. It works as expected!
Hi @v-micsh-msft,
I have ran into the same problem, I wanted to have my field auto-fill the person who is using the powerapp form. I have used OData function inside the default option and what I get in return is "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser". What am I doing wrong?
hi @Daemagor
You are doing everything correctly. You have to choose which data you want the field to show since the record contains several different values.
To change which value it displays:
1. Select the card
2. Select Advanced in the right tool box, under Data click more options.
3. Change Value from @odata.type o Display Name
@Anonymous,
That works, perfect, thank you so much!
hi,
I have the same issue but by using CDS. please,What can i do?
Thanks
Andi