
Hi all,
I'm having an issue with Power Apps, and any help I can get is greatly appreciated. I've tried researching it, including on this site, but nothing has worked so far.
I have a form, and for one of the data cards in the form, I'd like it to autopopulate the manager of the user, and then when the form is submitted, send this information to the people column of a SharePoint list.
I have this in the App OnStart:
Set(_myuserprofile,Office365Users.MyProfile());
Set(_chosenmanager, Office365Users.Manager(_myuserprofile.Id));
Set(_chosenmanagerPhoto, If(Office365Users.UserPhotoMetadata(_chosenmanager.Id).HasPhoto, Office365Users.UserPhoto(_chosenmanager.Id)))
I originally just had _chosenmanager in the default selected items, and that displayed the name of the manager in the form, but didn't send the information through to the SharePoint list.
Then, after some research, I tried:
If(FormLeaveRequest.Mode=FormMode.New, _chosenmanager, _chosenmanager)
and
If(FormLeaveRequest.Mode=FormMode.New, _chosenmanager, Parent.Default)
but had the same result, in that it displayed the correct name, but didn't feed the information to the SharePoint list when I submitted the form.
I did some more research, and tried
If(FormLeaveRequest.Mode=FormMode.New, {DisplayName: _chosenmanager.UserPrincipalName, Claims: "i0#.f|membership|" & _chosenmanager.Mail},Parent.Default)
and I also tried
If(FormLeaveRequest.Mode=FormMode.New, {DisplayName: _chosenmanager.DisplayName, Claims: "i0#.f|membership|" & _chosenmanager.Mail},Parent.Default)
But both of these don't even let me submit the form, even though it displays the correct email address, an error message just appears instead, saying 'The requested operation is invalid. Server response : SharePointListName failed: The specified user i0#.f|membership|Managername@company.com could not be found.' (It's definitely connected to Office365Users).
If it helps, this is what's in Update for the data card:
Manager_DataCardValue.Selected
Any solutions or work-arounds would be amazing.
Hi @Charlotte17 ,
It's i:0#.f|membership| not i0#.f|membership| .
If(FormLeaveRequest.Mode=FormMode.New, {DisplayName: "", Claims: "i:0#.f|membership|" & _chosenmanager.Mail,JobTitle:"",Picture:"",Department:"",Email:""},Parent.Default)
Best Regards,
Wearsky