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

Current user overwrites previous user

Hi,

 

I am running into an issue where the current user overwrites the previous user. For example, John Smith uses the form and the "Received by" field defaults to his name. After he saves the form, Mary Anne views the item and notices her name showing in the "Received by" field (it should show John Smith). 

 

I found a similar post which states to add a Refresh('YourSPList') formula in front of the OnNew, OnEdit and OnView property of the SharePointIntegration control. In my case, I added the Refresh('Test'); formula in front of the 3 modes and was still unable to resolve the issue. 

 

Solved: PowerApps People picker - Current User Issue in Ed... - Power Platform Community (microsoft....

 

Here is a screenshot of my card and combo box properties:

andwong_1-1629756795213.png

 

andwong_2-1629756953830.png

 

I am not sure what is wrong, but I have a feeling it might have something to do with my Default property(ies). Any help would be appreciated. 

 

Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions

@Anonymous ,

Well in this case...You were closed enough. Use:

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

Hope it helps !

View solution in original post

4 REPLIES 4
gabibalaban
Dual Super User
Dual Super User

@Anonymous ,

Yes, the problem is from Default Selected Items property of the DataCardValue14 which should  be left as it was ...

Parent.Default

What you did was to set default selected item to the current user of the app/sharepoint form.

 

Hope it helps !

Anonymous
Not applicable

Hi @gabibalaban,

 

Thanks for pointing me in the right direction. The DefaultSelectedItems property was originally modified from

 

Parent.Default

 

to

 

{

  DisplayName:User().FullName,

  Claims:"i:0#.f|membership|" & Lower(User().Email),

  Department:"", 

  Email:User().Email,

  JobTitle:"",

  Picture:""

}

 

because I wanted the form to default to the current user only when a new item is being created (OnNew mode only). I tried adding an IF statement to the above code (see below), but it still defaults to the current user in all modes. Am I missing something? 

 

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

@Anonymous ,

Well in this case...You were closed enough. Use:

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

Hope it helps !

Anonymous
Not applicable

Thank you @gabibalaban, your code worked perfectly! I appreciate your help

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Power Apps Ideas

Check out the New Ideas Site

We are excited to announce a new way to share your ideas for Power Apps!

Top Solution Authors
Top Kudoed Authors
Users online (4,620)