Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building Power Apps
Answered

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.

  • CE-16101943-0 Profile Picture
    81 on at
    Re: Update Column of Local Only Record that was Create with Defaults of Dataverse Table

    @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.

  • CE-16101943-0 Profile Picture
    81 on at
    Re: Update Column of Local Only Record that was Create with Defaults of Dataverse Table

    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'.

     

     

     

  • Verified answer
    Ninja_365 Profile Picture
    99 on at
    Re: Update Column of Local Only Record that was Create with Defaults of Dataverse Table

    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. 😊

     

  • Verified answer
    Shaheer Ahmad Profile Picture
    2,194 Super User 2025 Season 1 on at
    Re: Update Column of Local Only Record that was Create with Defaults of Dataverse Table

    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);

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,708 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,030 Most Valuable Professional

Leaderboard