RE: Copying matrix item and setting the value of a multiselect field
I’m using record.copy to copy an existing matrix item to create a new record and update a couple of fields with values for the newly copied record. The matrix item has a custom field that’s multiselect type representing length.
I can’t figure out how to set the value of the new record to get it to save properly. I keep getting an error of this type:
Invalid item option custitem_size for item xxxx
My code is:
var newRecord = record.copy({
type: ‘inventoryitem’,
id: 17386,
isDynamic: false
});
newRecord.setValue(‘custitem_size’, ??????);
var recordId = newRecord.save();
I tried several values for ?????? but I still get errors.
Its the syntax: See the below
newRecord.setValue({fieldId:‘custitem_size’,Value: ??????});