This topic contains 3 replies, has 0 voices, and was last updated by ashishshukla 9 years, 2 months ago.
-
AuthorPosts
-
September 16, 2015 at 9:22 am #6857
karennHello!
Now we are trying to update several custom fields of a custom record. We have been able to add the custom records no problem but getting a “java.lang.NullPointerException” every time we try to update the record in SuiteTalk and not sure what is wrong or what is null.
Here is our code for updating
CustomRecord pbMaster = new CustomRecord();
pbMaster.internalId = “79”;
StringCustomFieldRef stringCustomFieldRef = new StringCustomFieldRef();
stringCustomFieldRef.scriptId = “custrecord_pe_pbmastertrackno”;
stringCustomFieldRef.value = txtMasterTrackno.Text.Trim();
CustomFieldRef[] customFieldRef = new CustomFieldRef[1];
customFieldRef[0] = stringCustomFieldRef;
pbMaster.customFieldList = customFieldRef;
_service = new NetSuiteService();
setPassport(); // Set the Passport information for authentication
WriteResponse writeResponse = _service.update(pbMaster);
Just learning here. Used this example from NetSuite to build this
https://netsuite.custhelp.com/app/an…custom%20field
Not sure what I forgot to set or what I did wrong.
Thanks!
This is a cached copy. Click here to see the original post. -
September 17, 2015 at 1:18 am #6858
ashishshuklaHello Karenn,
In the code you only specified the custom record you wants to update, not the custom record type. You have to mention the both. Please refer following code –
CustomRecord customRecord = new CustomRecord();
RecordRef recordType = new RecordRef();
recordType.internalId = “14”; // // Record Type’s internal ID (Setup > Customization > Record Types > Basic Record Type (Internal ID=14)
recordType.type = RecordType.customRecord;
recordType.typeSpecified = true;
customRecord.recType = recordType;
customRecord.internalId = “7”; // internal id of the custom record you want to update
Use the rest code as you are already doing.
Hope this will help.
Thanks,
Ashish
-
September 17, 2015 at 7:37 am #6859
karennHI Ashish,
You saved me from myself again!! Thanks. I went right by that. Working great now.
Thanks again for the help!
Karen
-
September 17, 2015 at 7:41 am #6860
ashishshuklaYour welcome Karenn!!
-
AuthorPosts
You must be logged in to reply to this topic.