Reputation: 95
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!
Upvotes: 0
Views: 678
Reputation: 827
This might be related to your role permissions.
On NetSuite, go to Setup => Users/Roles => Manage Roles. Select the role you are using to access NetSuite through Web Services. Under the Permissions tab, select the "Transactions" subtab and add "Cash Sale". See below image:
Upvotes: 1
Reputation: 311
As its a custom field, check the access level of the field in the custom field creation form. May be you don't have sufficient privilege to edit this field.
Upvotes: 1