I have a form where based on ID entered in a textbox (DataCardValue1), i need to extract the employee display name from another sharepoint list and show it up on the people picker field. I am trying to do a Lookup but i am unsure of the syntax. Please help.
Here is the code i am trying to write in default
LookUp(SP DB,DataCardValue1.Text='ID').Employee
Ok understood so you need to add the following:
With(
{_Employee: LookUp(SP DB,DataCardValue1.Text='ID',Employee)},
{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
DisplayName:"",
Claims:"i:0#.f|membership|" & Lower(_Employee),
Department:"",
Email:_Employee,
JobTitle:"",
Picture:""}
)
You can leave some fields blank like picture etc... because they are not mandatory.
Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.
LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
Twitter: https://twitter.com/phipps0218
Hi @Sandeeprao8 ,
In that case the code to make this wor depends on the format of the information that is stored in the Employee column. If it is saved as a mail address the below should work:
With(
{_Employee: LookUp(SP DB,DataCardValue1.Text='ID',Employee)},
{'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
DisplayName:"",
Claims:"i:0#.f|membership|" & Lower(_Employee),
Department:"",
Email:_Employee,
JobTitle:"",
Picture:""}
)
@phipps0218 Employee is stored as text in the database. On the form where i want to load the employee detail is a people picker control. And it wouldnt allow me to add any attribute to Employee whether be displayname or email. It give me the error. Hope this is clarifies.
@Sandeeprao8 is Employee a People Picker? Can you do Employee.ID or Employee.Employee? If it is a people picker then it shouldn't be returning a text value.
Or it could be because you are saying the text value equals an ID which is a record value. Therefore rather than =ID you would need to do a lookup on a text value as well for example email...
Thanks @BCBuizer @phipps0218 for your response.
I am still getting the error message of incompatibility. Unable to convert.
"The property on this control expects record values. the rule produces text values which are incompatible"
@Sandeeprao8 , Do you get an error?
Either of the following would work:
LookUp(SP DB,DataCardValue1.Text='ID',Employee)
LookUp(SP DB,DataCardValue1.Text='ID').Employee
Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.
LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
Twitter: https://twitter.com/phipps0218
Hi @Sandeeprao8 ,
Your syntax seem correct.
There is an alternative, but it's up to you to pick a way that suits your style:
LookUp(SP DB,DataCardValue1.Text='ID',Employee)