Discussions
Stay up-to-date with the latest news from NetSuite. You’ll be in the know about how to connect with peers and take your business to new heights at our virtual, in-person, on demand events, and much more.
New AI Community Guidelines. Please review and follow them to ensure AI use stays safe, accurate, and compliant.
Update Custom Object Fields - java.lang.NullPointerException
I have a helper method for updating a single field of a custom object, but when I run it I get an error: java.lang.NullPointerException
As far as I can tell I am following the "update" example in SuiteTalkWebServicesGuide. Can anyone offer some insight as to where I went wrong?
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); } 0