Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to list shipping methods on NetSuite?

Tags:

netsuite

I'm trying to list Ship Items (UPS, FedEx, etc..) via API. As it shows in Accounting > Shipping Items > List.

The documentation for the ItemFulfillment Record suggests that I use the operation GetSelectValue to list the shipMethod possible values (same as Ship Items).

The documentation for GetSelectValue (page 125) describes the SOAP request I need to use:

  <env:Body>
    <platformMsgs:getSelectValue>
      <fieldName fieldType="sales_salesOrder_shipMethod"/>
    </platformMsgs:getSelectValue>
  </env:Body>

But it's not working, it seems that the fieldType is wrong.

    <soapenv:Fault>
      <faultcode>soapenv:Server.userException</faultcode>
      <faultstring>org.xml.sax.SAXException: fieldType not found on {urn:core_2013_2.platform.webservices.netsuite.com}GetSelectValueFieldDescription</faultstring>
      <detail>
        <ns1:hostname xmlns:ns1="http://xml.apache.org/axis/">partners-java10005.bos.netledger.com</ns1:hostname>
      </detail>
    </soapenv:Fault>

Where can I find the correct fieldType to get a list of the Ship Items?

like image 932
Bruno Buccolo Avatar asked Nov 02 '22 06:11

Bruno Buccolo


1 Answers

Thanks to this post, I was able to come up with a C# solution.

var methods = new Hashtable();
var shipMethodFieldDesc = new GetSelectValueFieldDescription()
{
    field = "shipmethod",
    recordType = RecordType.estimate,
    recordTypeSpecified = true
};

// make connection.    

var result = connection.Service.getSelectValue(shipMethodFieldDesc, 0);
if (result.status.isSuccess)
{
    for (var i = 0; i < result.totalRecords; i++)
    {
       // cast to RecordRef 
       var itemRef = (RecordRef)result.baseRefList[i];

       methods.Add(itemRef.internalId, itemRef.name);
    }
}
like image 92
uberianmaan Avatar answered Jan 04 '23 15:01

uberianmaan