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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Update Column of Local...
Power Apps
Unanswered

Update Column of Local Only Record that was Create with Defaults of Dataverse Table

(1) ShareShare
ReportReport
Posted on by 81

I am trying to make a local default record without creating a new record in the Dataverse table, but I am having issues with the updating the default record values:

ex:

Set(rcdDefault, Defaults(Dataverse_Table)); --> Create a Blank record of the Default values for all columns of the Dataverse Table

//rcdDefaults = {'Value 1': Blank, 'Value 2': Blank}

//Update Method 1

Patch(rcdDefault, rcdDefaults, {'Value 1': "Example Text}); //-->Returns rcdDefault.'Value 1': Blank

//Update Method 2

Set(rcdDefaults,Patch(rcdDefault, {'Value 1': "Example Text})); //-->Returns rcdDefault.'Value 1': Blank

 

I've seen this solution posted, but it doesn't seem to be working for me.

Solved: Update value from only one column in local record - Power Platform Community (microsoft.com)

 

Does anyone know how I can create a local default record for a Dataverse table without making a new record in the dataverse when I do it? 

 

The goal is to allow the user to update the record without needing an internet connection.  The idea was to use the Defaults(Dataverse_Table) to get the correct record format and use that local record to store the updated values. Only when the user is done updating the record and the values are submitted to the database would the internet connection, again, be needed.  I know this can be done a different way, but that creates a record in the database at the same time I create local record and I wanted to try to make it so that would only happen once all the updates were made to the local record and I patch it to the Dataverse table.

Categories:
I have the same question (0)
  • Verified answer
    Shaheer Ahmad Profile Picture
    2,194 Moderator on at

    Step 1: Create a local record with default values
    Set(rcdDefault, Defaults(Dataverse_Table));

    Step 2: Update values in the local record
    Patch(rcdDefault, Defaults(Dataverse_Table)); or Patch(rcdDefault, Defaults(Dataverse_Table),{})

    This updates the local record with default values

    Step 3: Modify specific values in the local record
    Patch(rcdDefault, {'Value 1': "Example Text", 'Value 2': "Another Example"});

    Now rcdDefault should have the updated values locally

    Step 4: When ready, patch the updated local record back to the Dataverse table
    Patch(Dataverse_Table, rcdDefault);

  • Verified answer
    Ninja_365 Profile Picture
    99 on at

    Hi @ce_PowerPlay ,

    Creating the Local Record: Your method of using Set(rcdDefault, Defaults(Dataverse_Table)) is spot on for creating a local record with default values.

    Updating the Local Record: The tricky part is updating this local record. The Patch function is usually used for updating records in a data source, not local collections or variables directly. For local updates, you can directly modify the variable. For instance, you could do something like:

    Set(rcdDefault, { 'Value 1': "Example Text", 'Value 2': rcdDefault.'Value 2' })

    Pushing to Dataverse: Once you're ready to submit the data to Dataverse and you have an internet connection, then you can use the Patch function to create or update the record in your Dataverse table.

    I hope this gets you on the right track! If you find my solution helpful, please feel free to accept it. 😊

     

  • CE-16101943-0 Profile Picture
    81 on at

    Based on suggestions @Ninja_365 & @ShaheerAhmad you both provided I attempted the following and I had the following issues occur.  I was able to update the local record, but for some reason when trying to retrieve the value it says the value is blank, but in the global variables list it says the value in the record was successfully set to "Test".  I tried to set a label's text value to "rcdOpenAudit.Auditor" and the result was blank.

    ce_PowerPlay_1-1699742551066.png

     

    I then attempted to patch the record back to dataverse using this method:

    patch('EMP Spun Line 4 Process Audits',rcdOpenAudit)

    The results was an error:

    "The specific column 'Auditor' does not exist.   The column with the most similar name is 'Auditor'.

     

     

     

  • CE-16101943-0 Profile Picture
    81 on at

    @Ninja_365 & @ShaheerAhmad 

    I figured it out.  Your answers were correct, but I needed to use the logical names of the columns when editing the values in the record with the Set() function.  Everything else was exactly as you said.

    Do This:

    Set(rcdDefault, {cr999a_Value1:"Example Text", cr999a_Value2:"Example Text 2"})

    Instead of:

    Set(rcdDefault, { 'Value 1': "Example Text", 'Value 2': rcdDefault.'Value 2' })

    If the logical name is not used it creates a new column in the record.  When trying to patch the record back to the Dataverse it fails because I have created additional columns rather that don't exist in the Dataverse Table.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard