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 / Save a record (Patch)
Power Apps
Answered

Save a record (Patch)

(0) ShareShare
ReportReport
Posted on by 802

Hi

 

I have a function in my app whereby I want the user to be able to Save their progress so far (Patch (defaults) a new row to a Dataverse table), and then save this record as they go along. 

 

I don't want to use a Form, as I find them ugly. 

 

I have found a way to save the GUID of the saved record into a variable. I then am trying, when the user makes changes to this record and want to 'save' it and overwrite the dataverse row with the latest data, using the below code, but it's not working. Any ideas?

 

Basically, if the variable is not blank (so the user has already saved which Sets the variable), do a Patch to overwrite this with the latest data.

 

 

If(!IsBlank(VendGUID.'Canary Vends', First(Filter('Vends', 'Vends' = VendGUID.'Vends'),
Patch('Vends', 
{'Name of Submitter': User().FullName},
{'Change Request Number': CHGNumber_TI.Text},
{'Management group': MgmntGrp_CBB.Selected.Value},
{'DevOps Project Name': DevOpsProject_CBB.Selected.name},
{'DevOps Repo Name': DevOpsRepo_CBB.Selected.name},
{'Subscription Name': 'LZ-Sub-Name_TI'.Text},
{'Subscription type': SubType_CBB.Selected.Value},
{'Cost Center': CostCenter_CBB.Selected.'Cost Centre Code'},
{'Network - vnetCidr': vnetCidr_TI.Text}));

 

 

 

 

Once I have this sorted, if the variable is blank, I will do a Patch (defaults) action to create a new row.

 

Thanks

K

 

 

 

Categories:
I have the same question (0)
  • Abhilash_Swain Profile Picture
    901 on at

    @Kosenurm ,
    If(!IsBlank(CanaryVendGUID.'Canary Vends', 
    Patch('Canary Vends', First(Filter('Canary Vends', 'Canary Vends' = CanaryVendGUID.'Canary Vends'))
    {'Name of Submitter': User().FullName},
    {'Change Request Number': CHGNumber_TI.Text},
    {'Management group': MgmntGrp_CBB.Selected.Value},
    {'DevOps Project Name': DevOpsProject_CBB.Selected.name},
    {'DevOps Repo Name': DevOpsRepo_CBB.Selected.name},
    {'Subscription Name': 'LZ-Sub-Name_TI'.Text},
    {'Subscription type': SubType_CBB.Selected.Value},
    {'Cost Center': CostCenter_CBB.Selected.'Cost Centre Code'},
    {'Network - vnetCidr': vnetCidr_TI.Text})

    "");

     

     

    The "First(Filter('Canary Vends', 'Canary Vends' = CanaryVendGUID.'Canary Vends')" will help to patch the Item you want. So it should be inside patch. For easy identification I made the patch section in bold and if section italic.

     

    Please give a like to support and accept it if I answered you . 🙂  

     

     

  • Kosenurm Profile Picture
    802 on at

    Thanks for your help.

     

    When I input this, as advised, I get an error of 'Invalid number of arguments: received 3, expected 1"... ??

     

    If(!IsBlank(CanaryVendSave.'Canary Vends', 
    Patch('Canary Vends', First(Filter('Canary Vends', 'Canary Vends' = CanaryVendSave.'Canary Vends')),
    {'Name of Submitter': User().FullName},
    {'Change Request Number': CHGNumber_TI.Text},
    {'Management group': MgmntGrp_CBB.Selected.Value},
    {'DevOps Project Name': DevOpsProject_CBB.Selected.name},
    {'DevOps Repo Name': DevOpsRepo_CBB.Selected.name},
    {'Subscription Name': 'LZ-Sub-Name_TI'.Text},
    {'Subscription type': SubType_CBB.Selected.Value},
    {'Cost Center': CostCenter_CBB.Selected.'Cost Centre Code'},
    {'Network - vnetCidr': vnetCidr_TI.Text}), "");

     

    The variable is being set on another save button as...

     

    Set(CanaryVendSave, Patch('Canary Vends', Defaults('Canary Vends'),
    {'Name of Submitter': User().FullName},
    {'Change Request Number': CHGNumber_TI.Text},
    {'Management group': MgmntGrp_CBB.Selected.Value},
    {'DevOps Project Name': DevOpsProject_CBB.Selected.name},
    {'DevOps Repo Name': DevOpsRepo_CBB.Selected.name},
    {'Subscription Name': 'LZ-Sub-Name_TI'.Text},
    {'Subscription type': SubType_CBB.Selected.Value},
    {'Cost Center': CostCenter_CBB.Selected.'Cost Centre Code'},
    {'Network - vnetCidr': vnetCidr_TI.Text}));
    
  • Verified answer
    Abhilash_Swain Profile Picture
    901 on at

    @Kosenurm ,
    My Bad.

     

    If(!IsBlank(CanaryVendGUID.'Canary Vends'), 
    Patch('Canary Vends', First(Filter('Canary Vends', 'Canary Vends' = CanaryVendGUID.'Canary Vends'))
    {'Name of Submitter': User().FullName},
    {'Change Request Number': CHGNumber_TI.Text},
    {'Management group': MgmntGrp_CBB.Selected.Value},
    {'DevOps Project Name': DevOpsProject_CBB.Selected.name},
    {'DevOps Repo Name': DevOpsRepo_CBB.Selected.name},
    {'Subscription Name': 'LZ-Sub-Name_TI'.Text},
    {'Subscription type': SubType_CBB.Selected.Value},
    {'Cost Center': CostCenter_CBB.Selected.'Cost Centre Code'},
    {'Network - vnetCidr': vnetCidr_TI.Text})

    "");

     

     

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 400 Most Valuable Professional

#2
11manish Profile Picture

11manish 141 Super User 2026 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 109 Super User 2026 Season 2

Last 30 days Overall leaderboard