How to create a copy of a DAC (i.e. cloning it) in Acumatica Framework. I can of course create a new instance and set all the value individually but is there a method which does this for you?
I found the following method
PXCache<...>.CreateCopy(sourceRule);
However, this seems to copy everything, including the ID, CreatedBy etc. I would need a new DAC, with all relevant fields copied. How to do this please?
You can use
PXCache
CreateCopy
to perform the copy like you mentioned, then null/change the keys before inserting the new copy into the cache.Here is an example that will copy a sales line as a new line on a sale order extension: