cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Jasmin_Sch
Helper IV
Helper IV

Person field in power apps via combo box

Hi!

 

I created a repeating table in my app using gallery.

In this gallery I got text and choice columns which work perfectly.

 

I am just stuck with Person/Group column called “Wunschressource”.
90DC37D5-D6B9-4BE0-AE31-1220EC346815.jpeg

Default property:

 

{DisplayName:User().FullName}

 

My save button shows me an error:

 

Patch(Items; ThisItem; {LineTätigkeitBezug:InputTätigkeitBezug.Text; LineProjekttyp:InputProjekttyp.Text;LineStatus:'Input Status'.Selected.Value;LineWunschressource:'Input Wunschressource'.Selected)});;Collect(Items; {LineTätigkeitBezug:""; LineProjekttyp:"";LineStatus:"";LineWunschressource:""})

 

The argument of Line Wunschressource does not match the expected type text.

 

Moreover I do have an error in my On Succes property of my form:

 

ForAll(Items;Patch('3400 ILLU Arbeitspakete Items';Defaults('3400 ILLU Arbeitspakete Items');{Title:LineTätigkeitBezug;Projekttyp:LineProjekttyp;Status:{Value:LineStatus};Wunschressource:{SelectedItem:LineWunschressource};MasterID: 'Form new work package'.LastSubmit.ID}))

 

 

Record type is expected and in my formular there is a missing column called claims of type text.

 

I really don’t know what that means.

Can you help me here please?

30 REPLIES 30

@RandyHayes 


no I am sorry it still shows the same error....

 

I am really confused...does this help maybe?

7FD444B8-A9B6-4BC4-9322-C2F66F833BA9.jpegE7EC72FB-D157-4158-9BA2-927A433FA5BE.jpeg

RandyHayes
Super User III
Super User III

@Jasmin_Sch 

Sorry...sometime I forget how picky collection signatures are as we don't use them all that must (they are very overused in apps!).

 

Anyway...here's what you need to do.

In your OnStart of the app, put the following in your formula:

Set(glbEmptyPerson, { 
         Claims:"", 
         Department:"", 
         DisplayName:"", 
         Email:"", 
         JobTitle:".", 
         Picture:"."
    }
);

Run your OnStart.

 

Now, change your formula to the following:

Patch(Items; 
    ThisItem; 
    {LineTätigkeitBezug:InputTätigkeitBezug.Text; 
     LineProjekttyp:InputProjekttyp.Text;
     LineStatus:'Input Status'.Selected.Value;
     LineWunschressource:'Input Wunschressource'.Selected)
    }
);;
Collect(Items; 
    {LineTätigkeitBezug:""; 
     LineProjekttyp:"";
     LineStatus:"";
     LineWunschressource:glbEmptyPerson
    }
)

 

And the other to this:

NewForm('Form new work package');;
ClearCollect(Items; 
    {LineTätigkeitBezug:"";
     LineProjekttyp:"";
     LineStatus:"";
     LineWunschressource: glbEmptyPerson
    }
);;
Navigate('Screen New work package';ScreenTransition.Cover)
_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes wow Thank you!

 

we almost got there 🙂

 

the error disappeared. 
The default value for the combo box is always my name. Can this be blank. And let’s say I change my name and chose another one. After I added a new row my name is again in the first row. funny thing though: if I submit the form, the correct name appears in the Sharepont list. 
Moreover I can make a multiple select in my combo box. Can this be limited to just one?

 

Thank you so much!

RandyHayes
Super User III
Super User III

@Jasmin_Sch 

Yes, at this point all of the properties of your controls in the Gallery should be set as follows:

 

Default on InputTätigkeitBezug : ThisItem.LineTätigkeitBezug

Default on InputProjekttyp : Thisitem.LineProjekttyp
Default on 'Input Status' : ThisItem.LineStatus
DefaultSelectedItems on 'Input Wunschressource' : ThisItem.LineWunschressource

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes @You are genius! Thank you!

it finally works.

 

Is there a way to show me the departement  of the selected person in another item?

RandyHayes
Super User III
Super User III

@Jasmin_Sch 

Just to display it?

Sure, put a label in your gallery and set the Text to: 'Input Wunschressource'.Selected.Department

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes And in case I am not selecting a specific person for my task bu just a department in general, is it then possible to type in my department and leave the combo box empty?

RandyHayes
Super User III
Super User III

@Jasmin_Sch 

You could, but that would be a different column.  You couldn't set your person column to a department.  But you could add another column for that.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

@RandyHayes 

Hi Randy,

 

I am very sorry to disturb you again but I face some problems with this solution.

If I create a new work package with lets say 3 action items (but only 2 of them with a specific person chosen in my choice field), it only submits these 2 action items. The one with an empty person choice field is not in my SharePoint list. Any  idea what might be the cause? Thank you very much!

DAC146DF-E1C9-4BA7-A51F-FB05C4167145.jpeg3083736A-239D-4454-83FC-BDB375B1EE03.jpeg

@RandyHayes 

I still was not able to fix it..

It only submit the rows of my gallery to my SP list in which a person is chosen.

After submitting an error occurres: 

The requested operation is invalid. the stated user was not found.
 
Can you please help me with this? Thank you!

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 (1,425)