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.
Now is the time to ask your NetSuite-savvy friends and colleagues to join the NetSuite Support Community! Refer now! Click here to watch and learn more!
Stay in the Know
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
Be sure you're subscribed to NetSuite communication to stay in the know about monthly happenings, updates and announcements. Subscribe
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