I am trying to update a field in a custom object, but when I do I get an error java.lang.NullPointerException
.
There is also this in the Code object of the exception: http://schemas.xmlsoap.org/soap/envelope/:Server.userException
. This S/O thread indicates it may be something wrong with the request I sent that caused the server to throw the exception. But what? There are no details in the exception.
As far as I can see I'm following the update example in "SuiteTalk (Web Services) Platform Guide" with the exception that this is a "CustomRecord" an not a "Customer", so I had to make some changes.
This is the method I have to help updating CustomRecords. The error happens in the final line where I actually make the request:
private static void UpdateCustomRecordValue(CustomRecord customRecord, string fieldName, string newValue, NetSuiteService netsuiteService)
{
var field = customRecord.customFieldList.Where(custField => custField.scriptId == fieldName).FirstOrDefault();
if (field == null) return;
var updateRecord = new CustomRecord();
updateRecord.scriptId = customRecord.scriptId;
CustomFieldRef[] custFieldList = new CustomFieldRef[] {
new StringCustomFieldRef
{
value = newValue,
scriptId = field.scriptId
}
};
updateRecord.customFieldList = custFieldList;
var updateResponse = netsuiteService.update(updateRecord);
}