cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mattthew
Advocate I
Advocate I

How To: Patching people selection with if is blank

I have patched through a people selection using Shane Young's tutorial .  The issue I came across is if it is not selected it won't patch through.  How can I wrap a function around it to still patch through the rest of the values and leave that selection blank?

 

Error received if left blank:  'The specified user could not be found'

 

{Title: galProjectList.Selected.'Short Title',
Collaborator: {
    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
    Claims: "i:0#.f|membership|" & Lower(DS_Collab_Select.Selected.Mail),
    Department: "",
    DisplayName: "",
    Email: DS_Collab_Select.Selected.Mail,
    JobTitle: ".",
    Picture: "."
 },

 

1 ACCEPTED SOLUTION

Accepted Solutions
KrishnaV
Super User
Super User

Hi @mattthew ,

 

Sorry for the little late in reply, here is the code snippet to patch even though we don't have value for people field.

Patch(
    'Project Details',
    Defaults('Project Details'),
    {Title: galProjectList.Selected.'Short Title'},
    If(
        !IsBlank(DS_Collab_Select.Selected.Mail),
        {
            Collaborator: {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Claims: "i:0#.f|membership|" & Lower(DS_Collab_Select.Selected.Mail),
                Department: "",
                DisplayName: "",
                Email: Lower(DS_Collab_Select.Selected.Mail),
                JobTitle: ".",
                Picture: "."
            }
        }
    )
);

Here is the working model of the above code block.

Patch with people picker.gif

 

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

 

Regards,

Krishna
If this post helps, then please consider Accept it as the solution and give thumbs-up to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

3 REPLIES 3
KrishnaV
Super User
Super User

Hi @mattthew ,

 

Sorry for the little late in reply, here is the code snippet to patch even though we don't have value for people field.

Patch(
    'Project Details',
    Defaults('Project Details'),
    {Title: galProjectList.Selected.'Short Title'},
    If(
        !IsBlank(DS_Collab_Select.Selected.Mail),
        {
            Collaborator: {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
                Claims: "i:0#.f|membership|" & Lower(DS_Collab_Select.Selected.Mail),
                Department: "",
                DisplayName: "",
                Email: Lower(DS_Collab_Select.Selected.Mail),
                JobTitle: ".",
                Picture: "."
            }
        }
    )
);

Here is the working model of the above code block.

Patch with people picker.gif

 

I hope this resolved your issue if you see any challenge let me know I am always happy to help.

 

Regards,

Krishna
If this post helps, then please consider Accept it as the solution and give thumbs-up to help the other members find it more.


I hope this resolved your issue if you see any challenge/need further help please let me know I am always happy to do it for my community.

Regards,
KrishnaV
Business Applications MVP, Microsoft Certified Trainer
Twitter | Linkedin | YouTube | GitHub
If this post helps you give a and if it solved your issue consider Accept it as the solution to help the other members / new members of the community.

View solution in original post

Thanks @KrishnaV 

Hi Krishna,

 

Actually, I tried on the same, I am not getting any error, but only people picker is not updating to blank, remaining fields are okay, could you help on the same

 

Patch(
'Patch', ThisItem,
{ Title: DataCardValue1.Text},
// {REGION: DataCardValue2.Selecteditems}
If(
!IsBlank(DataCardValue3.Selected.Email),
{
Person:{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Claims: "i:0#.f|membership|" & Lower(DataCardValue3.Selected.Email),
Department: "",
DisplayName: "",
Email: User().Email,
JobTitle: ".",
Picture: "."
}
}
)


)

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

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