Error when trying to use copyObj


#1

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’);
f.copyObj(Type.make({name:“ItemFacilitySnapshot”}),false);

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


#2

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.


#3

I just tried

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

and the object got saved without any issues


#4

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.