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

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

4 REPLIES 4
v-xida-msft
Community Support
Community Support

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

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 .

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

ntinykumar
Regular Visitor

Its worked for me. 

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

PowerPlatform 768x460.png

Microsoft Learn

Check out our new Discover Your Career Path blog post series and get all the details.

Users online (2,584)