I am calling a JS Snippet after editing a few rows from a Table.
My requirement is to clone the changed rows and save the edits only to the cloned records. And I want to keep the original rows unchanged.
What I did here :
-Used the “changed” object to get the edited values
-Used the “originals” object to get old values and reverted the changes done to the existing record.
-Since I thought it would be a better idea to clone the records using the standard salesforce clone function, I passed those values to an apex class, cloned the records there.
Now I am confused, how the data is affected in the model. I guess the newly created records through Apex won’t be loaded in the model.
Hence I tried a model.save() and then a model.updateData(). The updateData() is throwing an error that says " you have unsaved changes in xyz model( which however is not the model I am working with) and save or cancel changes before updateData()". I am sure I am missing something silly here.
Any inputs? or a better way to do this?
Thanks in advance.