web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Using Patch to udpate ...
Power Apps
Answered

Using Patch to udpate record

(0) ShareShare
ReportReport
Posted on by 163

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

Categories:
  • v-siky-msft Profile Picture
    Microsoft Employee on at

    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

  • ErikM9 Profile Picture
    163 on at

    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

  • Verified answer
    v-siky-msft Profile Picture
    Microsoft Employee on at

    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

  • ErikM9 Profile Picture
    163 on at

    This is great. Thank you.

    I will give it try this week.

     

    Erik

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 345 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 312

#3
Mohsin Ali Profile Picture

Mohsin Ali 252

Last 30 days Overall leaderboard