Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3983482
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T05:39:13+00:00 2026-05-20T05:39:13+00:00

The documentation for Netsuite is quite lacking, they cover the basics and then let

  • 0

The documentation for Netsuite is quite lacking, they cover the basics and then let you loose to explore. Anyone without a vast knowledge of PHP trying to use their php toolkit would be on their knees begging for mercy.

At any point throughout this whole project it’s been trail and error and trying to make sense out of everything until stuff started to work.

I’m stumped on assigning custom fields to sales orders, I know it has to be an object of an object of an object in order for it to tier down the xml for the soap to take over but what with what with what?

I have some code I worked that is getting somewhere but it is complaining it’s not the right RecordRef type. If anyone worked with Netsuite and feels my pain please lend me your knowledge before I pull out all my hair.

Thanks in advance.

Code:

$customFields = array('internalId' => 'custbody_new_die_yn','value' => array('name' => 'custbody_new_die_yn','internalId' => 'NO'));
$customObject = new nsComplexObject("SelectCustomFieldRef");
$customObject->setFields($customFields);

$salesOrderFields = array(

    'entity'        => new nsRecordRef(array('internalId' => $userId)),
    'paymentMethod' => array('internalId' => 8),
    'ccNumber'      => 4111111111111111,
    'ccExpireDate'  => date("c", mktime(0,0,0,11,1,2011)),
    'ccName'        => 'Test Testerson',
    'itemList'  => array(
        'item'  => array(
            'item'      => array('internalId' => 5963),
            'quantity'  => 5
        )
    ),
    'department' => new nsRecordRef(array('internalId' => 1)),
    'class' => new nsRecordRef(array('internalId' => 47)),
    'customFieldList' => $customObject
);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T05:39:13+00:00Added an answer on May 20, 2026 at 5:39 am

    I am not familiar using PHP with Netsuite but I have done a good amount of c#/.net Netsuite work. As Craig mentioned I find it much easier using a language such c#/.net with a Visual Studio generated interface to figure out what is available in the Netsuite SuiteTalk web service API.

    There is a fair amount of documentation around this stuff in the NetSuite Help Center – by no means everythign you will need but a good start. Netsuite Help Center

    Check out the SuiteFlex/SuiteTalk (Web Services) section specifically this page on Ids & References.
    Using Internal Ids, External Ids, and References

    With that said I will try to help with a .net example & explanation of adding a custom field to a Sales Order.

    Here are a few examples of adding different CustomFieldRefs:

    //A list object to store all the customFieldRefs
    List<CustomFieldRef> oCustomFieldRefList = new List<CustomFieldRef>();
    
    //List or Record Type reference
    SelectCustomFieldRef custbody_XXX_freight_terms = new SelectCustomFieldRef();
    custbody_XXX_freight_terms.internalId = "custbody_XXX_freight_terms";
    ListOrRecordRef oFreightTermsRecordRef = new ListOrRecordRef();
    oFreightTermsRecordRef.internalId = <internalId of specific record in Netsuite>;
    //See the References link above for more info on this - trying to figure out typeId caused me a lot of pain.
    oFreightTermsRecordRef.typeId = <internalId of the List Record Type in Netsuite>; 
    custbody_XXX_freight_terms.value = oFreightTermsRecordRef;
    oCustomFieldRefList.Add(custbody_XXX_freight_terms);
    
    //Freeform text sorta field            
    StringCustomFieldRef objStringCustomFieldRef = new StringCustomFieldRef();
    objStringCustomFieldRef.internalId = "custbody_XXX_tracking_link";
    objStringCustomFieldRef.value = "StringValue";
    oCustomFieldRefList.Add(objStringCustomFieldRef);
    
    //Checkbox field type
    BooleanCustomFieldRef custbody_XXX_if_fulfilled = new BooleanCustomFieldRef();
    custbody_XXX_if_fulfilled.internalId = "custbody_XXX_if_fulfilled";
    custbody_XXX_if_fulfilled.value = true;
    oCustomFieldRefList.Add(custbody_XXX_if_fulfilled);
    
    //By far the most complicated example a multi-select list referencing other records in Netsuite
    MultiSelectCustomFieldRef custrecord_XXX_transaction_link = new MultiSelectCustomFieldRef();
    //internal id of field you are updating
    custrecord_XXX_transaction_link.internalId = "custrecord_XXX_transaction_link";
    
    List<ListOrRecordRef> oListOrRecordRefList = new List<ListOrRecordRef>();
    
    ListOrRecordRef oListOrRecordRefItemFulfillment = new ListOrRecordRef();
    oListOrRecordRefItemFulfillment.name = "Item Fulfillment";
    oListOrRecordRefItemFulfillment.internalId = <ItemFulfillmentInternalId>;
    //Item Fulfillment is record type (Transaction -30) - this is from the above Reference links
    oListOrRecordRefItemFulfillment.typeId = "-30";
    oListOrRecordRefList.Add(oListOrRecordRefItemFulfillment);
    
    ListOrRecordRef oListOrRecordRefSalesOrder = new ListOrRecordRef();
    oListOrRecordRefSalesOrder.name = "Sales Order";
    oListOrRecordRefSalesOrder.internalId = <SalesOrderInternalId>;
    //Sales Order is record type (Transaction -30) - this is from the above Reference links
    oListOrRecordRefSalesOrder.typeId = "-30";
    oListOrRecordRefList.Add(oListOrRecordRefSalesOrder);
    
    //Add array of all the ListOrRecordRefs to the MultiSelectCustomFieldRef        
    custrecord_XXX_transaction_link.value = oListOrRecordRefList.ToArray();
    oCustomFieldRefList.Add(custrecord_XXX_transaction_link);
    
    //And then add all these to the Custom Record List (Array) on the Sales Order Record
    objSalesOrder.customFieldList = oCustomFieldRefList.ToArray();
    

    From what I can tell in your above example I think your issue is with the ListOrRecordRef typeId. Its hard to tell from your example what typeId you are referencing but if you can figure that out and set the TypeId on your SelectCustomFieldRef I think that should fix your issue.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Documentation is severely lacking on anything to do with stored procedures in mysql with
The documentation on ChromeWorkers says that they have chrome privileges, and chrome privileges are
Documentation says that waypoints limit is 8 points. But I have to calculate a
Documentation can be found here It says in the example: onDrop: Called whenever a
Documentation simply states that setting setAutosavingDelay to anything > 0 on the shared doc
Documentation states: Adds a user-defined custom member to an instance of a Windows PowerShell
Documentation says: The Grails team discourages the embedding of core application logic inside controllers,
Documentation says Dictionary keys order is unspecified. I guess it means the first added
Documentation states: Files are included based on the file path given or, if none
The documentation for the round() function states that you pass it a number, and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.