cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
JimmyWork
Power Participant
Power Participant

Display default value of person column from SharePoint in powerapps

Hi

 

What I'm trying to achieve is to display the selected person when i click edit form in power apps.

My column is a SharePoint person column named "Approver"

When i go to power apps and click edit the form for the specific item the default value should display the person in the column but it display nothing.

 

The default value i have tried to set it to ThisItem.Approver but the result is the same it is blank.
If i try ThisItem.Approver.displayName i get an error due to it is a person column and will not display a text string but needs a record.

 

Approver column = SharePoint Person column.
Approver items = Office365Groups.ListGroupMembers("groupID").value

But how do i fetch back the data from the SharePoint column so it default displays the person in the "Appprover" column

1 ACCEPTED SOLUTION

Accepted Solutions

Hi@JimmyWork,

Sorry for the late reply.

Based on the issue you mentioned, let me explain it.

Square brackets usually imply it's a collection/table element. So how you set your Item property determines which symbol you should use to quote.

 

[ThisItem.Approver.DisplayName]

 

The expression above may be a table column in your Table, so you have to use “[“,“]” to quote it.

The Item you set the 'Approver' is a table, too.

 

Best Regards,

Qi Qiao

View solution in original post

9 REPLIES 9
JimmyWork
Power Participant
Power Participant

Tried this in Default but still no luck

 

{ 
  '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",	
  DisplayName:ThisItem.Approver.DisplayName,
  Claims:"i:0#.f|membership|" & ThisItem.Approver.Email, 
  Email:ThisItem.Approver.Email
}

When the form is in edit mode i want i to pre select the data from the SharePoint person column "Approver"
So if the column contains the user "John Smith"

Then when i click edit form in power apps i want "John Smith" to be pre selected 

Seems that if i put this in DefaultSelectItem it works, don't know why i need the brackets?

[ThisItem.Approver.DisplayName]

Hi@JimmyWork,

Do you want that whenever users try to add a new record, keep a specific person as selected automatically (default) in person field?

You must set the DefaultSelectedItems property which makes your expressions work. 

I have a test on my side which goes well.

0505-1.png

And as an alternative solution, you can try the following formula in DefaultSelectedItems property:

If(

    EditForm1.Mode = FormMode.Edit,

    {

        DisplayName: ThisItem.Approver.DisplayName,

        Claims: "i:0#.f|membership|" & Lower(ThisItem.Approver.DisplayName)

    },

    Parent.Default

)

Thank you @v-qiaqi-msft I have tested your solutions before i saw your post and it does not work for me.

 

I just want it to keep the when you click edit form/item. If i use your options they will all end up blank.
For example the below will just say "Select Approver" will not display the already selected approver.

If(

    FormEditTicket_1.Mode = FormMode.Edit,

    {

        DisplayName: ThisItem.Approver.DisplayName,

        Claims: "i:0#.f|membership|" & Lower(ThisItem.Approver.DisplayName)

    },

    Parent.Default

)

  Same goes for the part below, i already tested this and it will also just stay blank.

{ 
  '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",	
  DisplayName:ThisItem.Approver.DisplayName,
  Claims:"i:0#.f|membership|" & ThisItem.Approver.Email, 
  Email:ThisItem.Approver.Email
}


If the column "Approver" contains a person i want that person to be the default value if the form is in display or edit mode. None of the above works. But this line works and i don't know why, the closing brackets makes the difference

[ThisItem.Approver.DisplayName]


2020-05-05 09_32_30-Beta Helpdesk Testing 2 - Saved (Unpublished) - Power Apps.png2020-05-05 09_32_39-Beta Helpdesk Testing 2 - Saved (Unpublished) - Power Apps.png

bump

I just need to understand what the brackets do and why they work and nothing else.
Can i use the Brackets or is it a big no in powerapps?

Sorry for bumping this again but i really need clarification if i can use with square brackets ?

[ThisItem.Approver.DisplayName]

 

Hi@JimmyWork,

Sorry for the late reply.

Based on the issue you mentioned, let me explain it.

Square brackets usually imply it's a collection/table element. So how you set your Item property determines which symbol you should use to quote.

 

[ThisItem.Approver.DisplayName]

 

The expression above may be a table column in your Table, so you have to use “[“,“]” to quote it.

The Item you set the 'Approver' is a table, too.

 

Best Regards,

Qi Qiao

View solution in original post

@v-qiaqi-msft Thank you for the explanation, much appreciated.

 I can now move forward and be happy with using a correct solution 🙂

Helpful resources

Announcements
PA User Group

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Solution Authors
Top Kudoed Authors
Users online (72,488)