cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Arikrishnan
Regular Visitor

in Canvas app, how to set value of people picker datacard through program

Dear PowerApp Experts

 

Please help me out for my below query.

 

I am trying to create canvas app in which I have many fields, 3 fields are people picker field, this filed I want to set value from some other SharePoint List, based on some filed value input from the current canvas app.

 

Scenario:

 

Field : Department - Dropdown field of current canvas app

Field : Group - Dropdown filed  of current canvas app

 

based on the above 2 fields combination (key), lookup from another SharePoint List which is master

this master SharePoint List has the below fields

 

Key : Department + Group 

Mail To : People Picker field

Mail CC : People Picker field

Mail BCC : People Picker field

 

as and when user selects Department & Group, based on this detail "Mail To", "Mail CC" & "Mail BCC" data should be picked from master SPList and store in this canvas app programmatically.

 

I tried using "Set" statement, i am not able to achieve

I tried created collection and put that in "Default" properly of the people picker column (form field)

 

But I am getting error.

 

I tired of getting solution from Google, Youtube but I could not achieve my desired result

 

Please help  

 

Thanks

Arikrishnan

1 ACCEPTED SOLUTION

Accepted Solutions
AmDev
Super User
Super User

Hi @Arikrishnan  - I'm assuming you have three combo boxes for each of the person fields you want to prepopulate.

 

Taking one as an example (Mail To), you can try using a LookUp formula in the 'DefaultSelectedItems' Property of the combox that you want to prepopulate:

 

LookUp(YourLookUpList,

Concatenate(DropdownDept.Selected.Value, DropdownGroup.Selected.Value)  = Key, 'Mail To')

 

You would just copy this and change the red text to output the other fields for the other two people picker fields. Not sure exactly how you combine the Dept and Group in Key column, but you might want to modify the concatenate function to include any delimiters and spaces between the values, so that it exactly matches how the values are combined in your key column.

 

Hope this helps - Good Luck! ☘

View solution in original post

6 REPLIES 6
AmDev
Super User
Super User

Hi @Arikrishnan  - I'm assuming you have three combo boxes for each of the person fields you want to prepopulate.

 

Taking one as an example (Mail To), you can try using a LookUp formula in the 'DefaultSelectedItems' Property of the combox that you want to prepopulate:

 

LookUp(YourLookUpList,

Concatenate(DropdownDept.Selected.Value, DropdownGroup.Selected.Value)  = Key, 'Mail To')

 

You would just copy this and change the red text to output the other fields for the other two people picker fields. Not sure exactly how you combine the Dept and Group in Key column, but you might want to modify the concatenate function to include any delimiters and spaces between the values, so that it exactly matches how the values are combined in your key column.

 

Hope this helps - Good Luck! ☘

Hello @AmDev , wow, it is great, it worked

But I tried similar thing, with help of Microsoft Document help, i failed to understand what mistake i did

Anyway, thanks a lot for your support.

Dear @AmDev 

 

Sorry to Disturb you, yesterday i tested, yes the field was assigned, when save form, it got saved though it was required field (at SharePoint list side) but it saved

 

When I went to SP list i found the record saved without those fields. How SP list allowed to save the record ?

 

I am again confused what could be the problem, why power app says form submit event is successful but data did not get saved for 3 People picker field which was assigned value from master SP List in Power App form field

 

Please help me what is going wrong?

 

Thanks in advance.

AmDev
Super User
Super User

Hi @Arikrishnan  - are the 3 fields in a form? If so, what code is I the update property of each data card?

Arikrishnan
Regular Visitor

Dear @AmDev , Thanks for your reply

 

the coding as per your above reply

 

in Data card property
Update : DcardAprv1Value.SelectedItems

 

in DacardValue card of the above data card.

Items                          : Choices([@'Expense Approval'].Approver1)
DefaultSelectedItems : LookUp('Expense Category', Concatenate(drpdwnCateg.SelectedText.Value,drpdwnDept.SelectedText.Value) = Title_Dept_Key, Approver1 )

 

before your first reply it was not shown in the datacard in display, after your above setting, the value was shown in people picker field on the screen and started saving (previously the data was not saved )

 

There are 3 Column in SharePoint as People Picker. out of these 3 column

Approver1 - This column is mandatory (required field)

Approver2 & Approver3 - These 2 columns are not required column but out of these 2 Approver2 column getting saved the value but not in Approver1 & Approver3

 

I am planning to re-create the app from scratch and check, meantime if you have any solution please let us know.

Thanks in advance.

Regards

Dear @AmDev 

 

I created new power app, it works there, the field is saving in SP List

 

Thanks for your support 

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

Top Solution Authors
Top Kudoed Authors
Users online (2,219)