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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Top Kudoed Authors
Users online (3,818)