cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
ErikM9
Helper I
Helper I

Using Patch to udpate record

Hi All,

 

I'm having issues getting a function to work based on the posting here.

 

I have a datasource with the following columns

Business Unit | Site name | AWS | RBA | 3R

 

The Business unit and Site name columns are already populated.

I've already been able to pull a user name from Office365.

 

My goal is to search for a user. Then match that user to a specific Business unit and Site name (could just be dropdowns), then, using check box (if appropriate), select if that user is an AWS, RBA or 3R? Then use a button to update the specified Business unit and Location record and with the User name to appear in the appropriate columns of AWS, RBA or 3R depending on what was selected.

 

It will/should be possible to have multiple names within the AWS, RBA, 3R record fields.

 

From what I've been seeing, I'll need to use a combination of Patch and the If function. I am confused by docs.microsoft and why the Filter function would be used with Patch?

 

Thank you very much for your assistance.

 

Erik

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @ErikM9 ,

 

So, the three columns are Person columns, and you want to patch O365User to these columns (Append, not Update) and link their names to email,  right? 

First, If you use dropdown to select O365 user and save it to one of three Person Columns, Please apply the following codes to button OnSelect. I save the match record to variable, and append the selected user name to original person column: 

 

Set(Var_Item, LookUp('Data source', 'Business Unit' = DropDown1.Selected.'Business Unit' && 'Site name' = DropDown2.Selected.'Site name' ) ); 
If(
AWS_Checkbox.Value, ClearCollect(SelectAWS,Var_Item.AWS); Patch(SelectAWS,Defaults(SelectAWS),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{AWS:SelectAWS}), 
RBA_Checkbox.Value, ClearCollect(SelectRBA,Var_Item.RBA); Patch(SelectRBA,Defaults(SelectRBA),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{RBA:SelectRBA}),
3R_Checkbox.Value,ClearCollect(Select3R,Var_Item.3R); Patch(Select3R,Defaults(Select3R),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{3R:Select3R})
)

 

 

Then, let's talk about how to display the person column and click on the name to open Outlook to send an e-mail. 

1. Add a MainGallery, and add a SubGallery in the MainGallery.

2. Set Items property of SubGallery to  ThisItem.AWS

3. Set OnSelect property of SubGallery to Launch("mailto:" & ThisItem.Email)

Snipaste_2019-12-10_10-24-33.png

Best regards,

Sik

View solution in original post

4 REPLIES 4
v-siky-msft
Community Support
Community Support

Hi @ErikM9 ,

 

What is the data source? What is the date type of those three columns? Are all names meet the same condition saved in one field?

If the columns are text type, please try the following codes, put them to Button OnSelect. Use variable to store the match record, then patch display name to field based on the original value.

 

Set(Var_Item, LookUp('Data source', 'Business Unit' = DropDown1.Selected.'Business Unit' && 'Site name' = DropDown2.Selected.'Site name' ) ); 
Patch('Data source', Var_Item, {AWS: If(AWS_Checkbox.Value, Var_Item.AWS &" "& UserDropDown.Selected.DisplayName), RBA: If(RBA_Checkbox.Value, Var_Item.RBA &" "& UserDropDown.Selected.DisplayName), 3R: If(3R_Checkbox.Value, Var_Item.3R &" "& UserDropDown.Selected.DisplayName)})

 

 

Best regards,

Sik

Hi Sik,

 

Thanks for your reply.

 

The data source is a SharePoint list. Ideally, the three columns would hold the office365 user. These fields would only be populated by names found in the company Active Directory.

 

As I continue to research, I'm beginning to suspect that I will not be able to accomplish this task.

The goal was to allow a user to view the name(s) in a column then click on the name to open Outlook to send an e-mail. 

We see this within the SharePoint view, and hoping we can do it in PowerApps.

 

Thanks,

 

Erik

Hi @ErikM9 ,

 

So, the three columns are Person columns, and you want to patch O365User to these columns (Append, not Update) and link their names to email,  right? 

First, If you use dropdown to select O365 user and save it to one of three Person Columns, Please apply the following codes to button OnSelect. I save the match record to variable, and append the selected user name to original person column: 

 

Set(Var_Item, LookUp('Data source', 'Business Unit' = DropDown1.Selected.'Business Unit' && 'Site name' = DropDown2.Selected.'Site name' ) ); 
If(
AWS_Checkbox.Value, ClearCollect(SelectAWS,Var_Item.AWS); Patch(SelectAWS,Defaults(SelectAWS),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{AWS:SelectAWS}), 
RBA_Checkbox.Value, ClearCollect(SelectRBA,Var_Item.RBA); Patch(SelectRBA,Defaults(SelectRBA),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{RBA:SelectRBA}),
3R_Checkbox.Value,ClearCollect(Select3R,Var_Item.3R); Patch(Select3R,Defaults(Select3R),{Claims:"i:0#.f|membership|" & UserDropDown.Selected.Mail ,Department:"",DisplayName:"",Email:"",JobTitle:"",Picture:""});
Patch('Data source',Var_Item,{3R:Select3R})
)

 

 

Then, let's talk about how to display the person column and click on the name to open Outlook to send an e-mail. 

1. Add a MainGallery, and add a SubGallery in the MainGallery.

2. Set Items property of SubGallery to  ThisItem.AWS

3. Set OnSelect property of SubGallery to Launch("mailto:" & ThisItem.Email)

Snipaste_2019-12-10_10-24-33.png

Best regards,

Sik

View solution in original post

This is great. Thank you.

I will give it try this week.

 

Erik

Helpful resources

Announcements
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

secondImage

Power Apps Community Call

Please join us on Wednesday, October 20th, at 8a PDT. Come and learn from our amazing speakers!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

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.

Top Solution Authors
Top Kudoed Authors
Users online (1,553)