RE: Permission Issue on Updating Custom Fields in Purchase Order Form.
Guys,
I have a requirement to update the custom fields in purchase order form. i have written the below code for implementing this functionality
var updatePurchaseOrder = new PurchaseOrder();
updatePurchaseOrder.internalId = InternalID;
oCustomFieldRefList = new List<CustomFieldRef>();
StringCustomFieldRef objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody4”;
objStringCustomFieldRef.value = “XXXXXX”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody1”;
objStringCustomFieldRef.value = “XXXXXX”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
objStringCustomFieldRef = new StringCustomFieldRef();
objStringCustomFieldRef.scriptId = “custbody16”;
objStringCustomFieldRef.value = “XXXXXX”;
oCustomFieldRefList.Add(objStringCustomFieldRef);
updatePurchaseOrder.customFieldList = oCustomFieldRefList.ToArray();
var response = Service.update(updatePurchaseOrder);
On executing the code i am getting the below error
You do not have permissions to set a value for element custbody4 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.
The custom fields which i am trying to update are displayed in the purchase order form in netsuite. I am also having ADMINISTRATOR privilege. Not sure why i am getting this error.
Also while trying to update the purchase order status i am getting the same error. code which i have written for updating the purchase order status is.
var updatePurchaseOrder = new PurchaseOrder();
updatePurchaseOrder.internalId = InternalID;
updatePurchaseOrder.orderStatus = PurchaseOrderOrderStatus._pendingBilling;
updatePurchaseOrder.orderStatusSpecified = true;
var response = Service.update(updatePurchaseOrder);
if (response.status.isSuccess != true) throw new Exception(response.status.statusDetail[0].message);
I have tried updating other fields displayed in the purchase order form like DEPARTMENT, LOCATION etc., which i was able to update without any error.
Please help me on fixing this issue.
Thanks in Advance.
Go check cutbody4 and see if it was set to View only on its field-level permission tab.