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.
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'});
Just in case you my answer helped you solve your problem, please mark/accept this as a SOLUTION. This helps community members if they experience a similar issue in the future. |
bistek.space @cha_bistek @BisTekSpace |
If you meant like this it's still not working.
The ID is automatically generated.
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)
Also check on hovering over the patch function error and see what the error message is conveying
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".
User | Count |
---|---|
252 | |
104 | |
94 | |
50 | |
39 |