This topic contains 3 replies, has 0 voices, and was last updated by ashishshukla 9 years, 2 months ago.

  • Author
    Posts
  • #6857

    karenn

    Hello!

    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.

  • #6858

    ashishshukla

    Hello 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

  • #6859

    karenn

    HI Ashish,

    You saved me from myself again!! Thanks. I went right by that. Working great now.

    Thanks again for the help!

    Karen

  • #6860

    ashishshukla

    Your welcome Karenn!!

You must be logged in to reply to this topic.