I have a people picker field in the SharePoint list and I am displaying that in PowerApps in New Form. Users should be able to enter user name and submit the form. It is working as expected.
Also, I would like this people picker to show current user name by default when new form shows up and if user doesn't change this in the people picker, it should just save current user name in the people field in SharePoint. I know that I can display current user by User().DisplayName but I am not sure where to put that. I have tried adding it in the Default property but that is not working. It is giving an error property expects record value but this produces a text value.
Solved! Go to Solution.
Have you tried removing the OnChange code and seeing if you still get the error? If you don't get an error then that would mean the OnStart manager code is working and maybe the issue is with getting the value from DataCardValue35 in the OnChange property.
Yes, unfortunately I removed and I still get the error.... I removed all code though and still the error, even after removing the Onstart function. I think there is something buggy with caching. I removed the connection as well, but when I look at the connections being used it still says this app is using the O365 connector.
Think it's time to have a break.. it is very confusing. The error I receive, I see it is a known issue... I will look at the various posts to see if there is some workaround e.g. this one: https://powerusers.microsoft.com/t5/General-Discussion/The-service-returned-an-error-Office365Users-...
@Jeff_Thorpe thanks, the error was with the onchange formula. Also, there was a caching issues going on in Chrome. I ended up logging out of Chrome and using Edge. I managed to delete the connections successfully as you suggested and I removed the onchange formula.. Funny though, in preview it works sometimes... The idea is that the requestor can submit on behalf of someone else. When they change the name of the person in the requestor field the manager updates to reflect.
Also interesting that in Chrome no error was displayed in edit mode against the datacardvalue, but in Edge an error displays straight away!
Don't suppose you have any idea why this formula is in error? I can raise a separate post if you prefer. thank you so much for your help.
In My scenario
On a sharepoint list i have two columns
Owner=People picker multiselect.
There are couple of products that has multiple owners whith people picker multiselect option.
I'm trying to get product information into powerapps and based on product we select a textbox should populate with owner information.
Did you try for any workaround. Please let me know.
Hi Jeff, yes after some confusing caching issues... and a switch from Chrome to edge to force the connection refresh, I determined the error is with the DataCardValue35 in the OnChange property.
It is good enough for now. If someone submits on behalf of someone else they just have to overwrite the manager field manually.
Is a shame I can't get it working, but will do for now. Was really strange as the formula worked in Chrome in preview and the app play properly in the browser in Chrome, but the connection error appeared in the mobile app... and in Edge the error is flagged on DataCardValue35 in edit mode.
Thanks for your help, if you do happen to know how to fix the onChange so that when the requestor field is changed, the manager field automatically updates to this person, that'd be great. When I get time, I will do some more experimenting.
erroneous formula that causes connection error - onChange datacardvalue35
Can you help me with how top delete a power users community account. I'm unable to find an option to delete my account. i accidently created two and don't want to use both.
Thanks in advance.
Thanks Jeff, it took me a while to figure it out. Got there in the end.
Initial onChange formula that caused error:
Corrected onChange Formula:
If(Len(DataCardValue5.Selected.Email)>0, Set(gvCurrentManager, Office365Users.ManagerV2(DataCardValue5.Selected.Email));Set(varManager, gvCurrentManager))
(DataCardValue5 = Requestor field)
Thanks for your help
Not sure if this has changed since it was first posted, but using User() with no . descriptor in the DefaultSelectedItems now works for the current user name in a people picker field. I think this answers the original question.
If(EditForm2.Mode = New,User(),Blank())
Works the same as the other solution, but you dont need all the stuff in the squigglies.