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 / Add rows when an item ...
Power Apps
Unanswered

Add rows when an item is edited in dataverse

(0) ShareShare
ReportReport
Posted on by 68

Hello all, I want to make the code so that everytime an item is edited to add a new row with the same id in dataverse. This is the code so far. Also i'm new to this so if anyone can help me it'll be perfect. Thank you in advance.

yllikrs_0-1669201843280.png

yllikrs_1-1669201925682.png

 

Categories:
I have the same question (0)
  • cha_cha Profile Picture
    4,932 Moderator on at

    Hello @yllikrs 

     

    Is the ID that you mean the automated one generated by Dataverse or are you making a custom ID column. 

     

    I see that your Patch code is right and would be enough to run what you need.

     

    As for your UpdateIf, this would be the right format but not sure if it's something that you need since it just updates the status but won't create a new row.

    If(Form_EditScreen.Mode = FormMode.Edit,
    UpdateIf(Inventories,
    Status='Status (Inventories)'.Active
    {Status: 'Status (Inventories).Inactive'}
    ));
    
    If(Form_EditScreen.Mode = FormMode.Edit,
     //Add your Patch code here.
    );
    UpdateIf(Inventories,
    Status='Status (Inventories)'.Active
    {Status: 'Status (Inventories).Inactive'});

     

     

  • yllikrs Profile Picture
    68 on at

    yllikrs_0-1669205095106.png

     

    If you meant like this it's still not working.

    The ID is automatically generated.

  • yllikrs Profile Picture
    68 on at

    Hello @cha_cha,

    Now the error is in the patch

    yllikrs_3-1669205351462.png

     

  • JatinSaini Profile Picture
    428 on at

    I do not understood that if you intent to create new entry while editing a specific entry, then why you are using two if's just to check if the mode of the form is edit.

    Use that condition only once and within it run your edit and new entry logic.

    If you do have the specific ID, then edit the record values using that ID in the UpdateIf condition and when it's done, patch new entry whose values will be of that ID only apart from the Status (if you want to change it back to Active)

  • JatinSaini Profile Picture
    428 on at

    Also check on hovering over the patch function error and see what the error message is conveying 

  • yllikrs Profile Picture
    68 on at

    No need to change it back to Active. Once it's inactive there's no need to change it back to Active. Thank you for your answer. As for the error on the patch by hovering it it says: "statecode: The specified column is generated by the server and can't be specified".

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 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard