cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
sasrsc1966
Resolver I
Resolver I

what is wrong with this patch? or is it the defaultSelectedItems? - Re; Combobox and Person Column

I am very close I know.
I'll start with the easy which is a single person (not multiple)
I can search for a user and save them to SP.
I can retrieve them again to change to someone else and save it to SP. Great.
But if I save it without changing the value it errors because it appears that when I retrieve them to edit on the form and I set the defaultSelectedItems the mail piece is missing. The Display Name is visible. 

This is my defaultSelectedItems where varItem is the value of the entire record. PersonSingle is the name of the SP column

 

{ 
    Claims:"i:0#.f|membership|" & Lower(varItem.PersonSingle.Email), 
    Department:"", 
    DisplayName:varItem.PersonSingle.DisplayName, 
    Email:varItem.PersonSingle.Email, 
    JobTitle:".", 
    Picture:"."
}

 


 I wondered if I was getting confused between Mail and Email.
When I patch I do this...

 

Patch(
    'Test List',
    LookUp(
        'Test List',
        ID = varItem.ID
    ),
    {
        PersonSingle: {
            '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
            Claims:"i:0#.f|membership|" & Lower(ComboBox1.SelectedItems.Mail),,
            Department: "",
            DisplayName: ComboBox1.Selected.DisplayName,
            Email: ComboBox1.Selected.Mail,
            JobTitle: "",
            Picture: ""
        }
    }
);

 

I've been looking at the monitor and it's sending the claims with the email address for a new selected person but it's definitely missing the email address if I just hit save. So that patching seems to be OK.
I guess it's related to the defaultSelectedItems and that's not retrieving the email.
If I do a label I do see the correct value and physically in the combobox I do see the person's DisplayName

 

varItem.PersonSingle.Email

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

1) I'm not doing this within a "form". It's a combobox dropped straight onto the canvas. 

2) I fixed it by making the defaultSelectedItems be...

Office365Users.SearchUser({searchTerm: varItem.PersonSingle.Email})

(varItem is the name of the object and it contains a single person SP column value)
This works, it returns a table and I can access see the email is present.
My patch is

Patch(
    'Test List',
    LookUp(
        'Test List',
        ID = varItem.ID
    ),
    {
        PersonSingle: {
            Claims:"i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
            Department: "",
            DisplayName: ComboBox1.Selected.DisplayName,
            Email: Lower(ComboBox1.Selected.Mail),
            JobTitle: "",
            Picture: ""
        }
    }
);


This has been a very confusing experience but it is working for a single person SP column.

View solution in original post

4 REPLIES 4
StalinPonnusamy
Super User
Super User

Hi @sasrsc1966 

 

If the SharePoint column is a single person then your patch will be

 

Patch(
    'Test List',
    LookUp(
        'Test List',
        ID = varItem.ID
    ),
    {
        PersonSingle: {
            Claims:"i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
            Department: "",
            DisplayName: ComboBox1.Selected.DisplayName,
            Email: Lower(ComboBox1.Selected.Mail),
            JobTitle: "",
            Picture: ""
        }
    }
);

 

 

Note: '@odata.type' line is not required. That is depreciated.


Thanks,
Stalin - Learn To Illuminate

Still having problems ... 

To be clear now after some revisions: the defaultSelectedItems on the combobox1 is ...

{ 
    Claims:"i:0#.f|membership|" & Lower(varItem.PersonSingle.Email), 
    Department:"", 
    DisplayName:varItem.PersonSingle.DisplayName, 
    Email:Lower(varItem.PersonSingle.Email), 
    JobTitle:".", 
    Picture:"."
}

The patch on the button is ... 

Patch(
    'Test List',
    LookUp(
        'Test List',
        ID = varItem.ID
    ),
    {
        PersonSingle: {
            Claims:"i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
            Department: "",
            DisplayName: ComboBox1.Selected.DisplayName,
            Email: Lower(ComboBox1.Selected.Mail),
            JobTitle: "",
            Picture: ""
        }
    }
);
Reset(ComboBox1);
Set(varItem,Blank())

It works when I add a new person or change it.
But it doesn't work if I don't change anything and just hit submit. It doesn't know the claims value...because the email piece is blank. 
I can do a label and show the

 "varItem: "& varItem.PersonSingle.Email & " - " & varItem.PersonSingle.DisplayName

and it is correct, so incoming the variable has a email value and a name.
But if I do a label for the combobox 

"combobox1: "& ComboBox1.Selected.Mail & " - " & ComboBox1.Selected.DisplayName

- the email value is missing

Hi @sasrsc1966 

 

DefaultSelectedItems Makes the value selected by default. I created a similar one and tested it with form new.

 

StalinPonnusamy_0-1643081535357.png

 

In this case, I haven't touched anything on this screen but was able to retrieve the data.

 

Mail and Email based on the Items property of the combo box.

Please let me know, the items' property of your combo?

 


Thanks,
Stalin - Learn To Illuminate

1) I'm not doing this within a "form". It's a combobox dropped straight onto the canvas. 

2) I fixed it by making the defaultSelectedItems be...

Office365Users.SearchUser({searchTerm: varItem.PersonSingle.Email})

(varItem is the name of the object and it contains a single person SP column value)
This works, it returns a table and I can access see the email is present.
My patch is

Patch(
    'Test List',
    LookUp(
        'Test List',
        ID = varItem.ID
    ),
    {
        PersonSingle: {
            Claims:"i:0#.f|membership|" & Lower(ComboBox1.Selected.Mail),
            Department: "",
            DisplayName: ComboBox1.Selected.DisplayName,
            Email: Lower(ComboBox1.Selected.Mail),
            JobTitle: "",
            Picture: ""
        }
    }
);


This has been a very confusing experience but it is working for a single person SP column.

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