I'm trying to save a cash sale in netsuite, we have a custom segment field called business unit (ScriptId = custbody_cseg2) and I need to put an specific value to it (Internal Id = 2 in the custom segment).
I'm using the following code who is pretty much the same we have in the netsuite's help but applied to a cash sale transaction:
SelectCustomFieldRef selectCustomFieldRef = new SelectCustomFieldRef();
ListOrRecordRef custSelectValue = new ListOrRecordRef();
custSelectValue.internalId = "2";
//custSelectValue.typeId = "286"; <- with or whitout doesn't change
selectCustomFieldRef.value = custSelectValue;
selectCustomFieldRef.scriptId = "custbody_cseg2";
CustomFieldRef[] customFieldRefArray = new CustomFieldRef[1];
customFieldRefArray[0] = selectCustomFieldRef;
cashSale.customFieldList = customFieldRefArray;
When I run this code I get the following error:
[Code=INSUFFICIENT_PERMISSION] You do not have permissions to set a value for element custbody_cseg2 due to one of the following reasons: 1) The field is read-only; 2) An associated feature is disabled; 3) The field is available either when a record is created or updated, but not in both cases.
Do anyone know what would be the error?
Thank you very much!