cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

PowerApps People picker - Current User Issue in Edit Form

Hi Team,

We are facing one strange issue with Person or Group(People Picker) column in PowerApps . We have created a column with show field as "Work Email".

Requirement is We need to show login user email in form(Requestor Email), user has the flexibility to change the value with other value as well

Issue : some time in Edit form it is showing current user email instead of existing value which was saved in list.

following is the code which we have tried

Initial : Approach 1

Default :

If(
    SharePointForm1.Mode = FormMode.New,
    {
        DisplayName: User().FullName,
        Claims: "i:0#.f|membership|" & Lower(User().Email),
        Department: "",
        Email: User().Email,
        JobTitle: "",
        Picture: ""
    },
    Parent.Default
)

 

Default Selected Items :

If(
    SharePointForm1.Mode = FormMode.New,
    {
        DisplayName: Office365Users.UserProfile(User().Email).DisplayName,        
        Claims: "i:0#.f|membership|" & Lower(Office365Users.UserProfile(User().Email).Mail),
        Department: "",
        Email: Office365Users.UserProfile(User().Email).Mail,
        JobTitle: "",
        Picture: ""
    },
    Parent.Default
)

 

Datacard :

Update:

If(Text(SharePointForm1.Mode)="1",{ 
  DisplayName:User().FullName,
  Claims:"i:0#.f|membership|" & Lower(User().Email), 
  Department:"",  
  Email:User().Email, 
  JobTitle:"", 
  Picture:""
},dcvRequestorEmail.Selected)

 

Later we have changed the code to as below ,

Approach 2 :

Data Card Value:

Default : 

If(
    SharePointForm1.Mode = FormMode.New,
    {
        DisplayName: Office365Users.UserProfile(User().Email).DisplayName,// User().FullName,
        
        Claims: "i:0#.f|membership|" & Lower(Office365Users.UserProfile(User().Email).Mail),
        Department: "",
        Email: Office365Users.UserProfile(User().Email).Mail,
        JobTitle: "",
        Picture: ""
    },
    DisplayName: Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).DisplayName,// User().FullName,
                Claims: "i:0#.f|membership|" & Lower(Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).Mail),
        Department: "",
        Email: Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).Mail,
        JobTitle: "",
        Picture: ""
    }
)

 Default Selected Items:

If(
    SharePointForm1.Mode = FormMode.New,
    {
        DisplayName: Office365Users.UserProfile(User().Email).DisplayName,// User().FullName,
        
        Claims: "i:0#.f|membership|" & Lower(Office365Users.UserProfile(User().Email).Mail),
        Department: "",
        Email: Office365Users.UserProfile(User().Email).Mail,
        JobTitle: "",
        Picture: ""
    },
    DisplayName: Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).DisplayName,// User().FullName,
        
        Claims: "i:0#.f|membership|" & Lower(Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).Mail),
        Department: "",
        Email: Office365Users.UserProfile(ThisItem.Requestor_x0020_Email.Email).Mail,
        JobTitle: "",
        Picture: ""
    }        
)

 

attached the mail for your reference,

 

Please let me know if need any thing more to dig into this issue . In simple words , As a requestor I have submitted the form and it was inserted into list with my name , when approver or other person opening the form in requestor place it is showing their email insted of requestor email. this is not a consistent behaviour some times we are facing this issue .

 

Thanks in Advance ,

Regards,
Mahesh.

 

1 ACCEPTED SOLUTION

Accepted Solutions
Community Support Team
Community Support Team

Re: PowerApps People picker - Current User Issue in Edit Form

Hi @Anonymous,

Yes, it is not necessary to add the complex code that you mentioned within the Default property of the Combo Box control, just remain/leave the default formula (e.g. DataCardValue4.Selected).

 

In addition, please add the Refresh('YourSPList') formula within the OnNew, OnEdit and OnView property of the SharePointIntegration control rather than the OnStart proeprty of the SharePointForm1 control.

The OnStart property of the SharePointForm1 control would be fired/triggered only once time after you run your custom form. More details about the limits on OnStart property, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/sharepoint-form-integration#customize-the-default-form

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

3 REPLIES 3
Highlighted
Community Support Team
Community Support Team

Re: PowerApps People picker - Current User Issue in Edit Form

Hi @Anonymous,

I have made a test on my side, and don't have the issue that you mentioned. Based on the formula that you provided, I think there is something issue with it.

Please take a try with the following workaround:8.JPG

 

9.JPG

 

10.JPG

Set the DefaultSelectedItems property of the Combo Box control (DataCardValue4) within the Executor Data card (Person field) to following:

If(
    SharePointForm1.Mode=FormMode.New,
    {
        Claims: "i:0#.f|membership|" & Lower(Office365Users.MyProfile().Mail),
        DisplayName: Office365Users.MyProfile().DisplayName,
        Department: "",
        Email: Office365Users.MyProfile().Mail,
        JobTitle: "",
        Picture: ""
    },
    Parent.Default
)

Set the Update property of the Executor Data card to following:

DataCardValue4.Selected     /* <- Modify your formula here , don't put your complex formula here */

Set the OnNew property of the SharePointIntegration control to following:

Refresh('YourSPList');    /* <-- Add this formula here */
NewForm(SharePointForm1)

Set the OnEdit property of the SharePointIntegration control to following:

Refresh('YourSPList');
EditForm(SharePointForm1)

Set the OnView property of the SharePointIntegration control to following:

Refresh('YourSPList');
ViewForm(SharePointForm1)

Please take a try with above solution, then check if the issue is solved.

 

In addition, if the issue still exists, please consider remove/delete the custom form for your SP list, then re-create a new one for it based on above solution I provided, check if the issue still exists.

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Anonymous
Not applicable

Re: PowerApps People picker - Current User Issue in Edit Form

Hi @v-xida-msft,

 

Thanks for the reply ,

 

the issue is not happening for users some times not all the time .

Is it not required to add the code in Default property of the DataCardValue ?

 

We are refreshing the list in "OnStart" Property of the Form .

 

Regards,

Mahesh .

Community Support Team
Community Support Team

Re: PowerApps People picker - Current User Issue in Edit Form

Hi @Anonymous,

Yes, it is not necessary to add the complex code that you mentioned within the Default property of the Combo Box control, just remain/leave the default formula (e.g. DataCardValue4.Selected).

 

In addition, please add the Refresh('YourSPList') formula within the OnNew, OnEdit and OnView property of the SharePointIntegration control rather than the OnStart proeprty of the SharePointForm1 control.

The OnStart property of the SharePointForm1 control would be fired/triggered only once time after you run your custom form. More details about the limits on OnStart property, please check the following article:

https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/sharepoint-form-integration#customize-the-default-form

 

Best regards,

Kris

Community Support Team _ Kris Dai
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Helpful resources

Announcements
firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

Top Kudoed Authors
Users Online
Currently online: 92 members 3,282 guests
Please welcome our newest community members: