Error when trying to use copyObj


I am trying to use copyObj and getting this error - “Error: Required return value missing for action ItemFacility.copyObj.” This is what I am trying:

f = ItemFacility.get(‘6013_11001927281’);

ItemFacility and ItemFacilitySnapShot are nearly identical except ItemFacilitySnapShot has an additional dateTime field.


Maybe it cannot convert to the dateTime field? Is there a default value for the dateTime field in ItemFacilitySnapshot? If not, then maybe it can’t create the new object, as it doesn’t know how to initialize the dateTime field. Just throwing out a guess here.


I just tried

fs = ItemFacilitySnapshot.make() ; fs.create();

and the object got saved without any issues


As Raj mentioned, the dateTime field is an optional field and were able to create records into the Snapshot type with out assigning a value to the field.