How to list shipping methods on NetSuite?

北城余情 提交于 2019-12-07 08:37:22

问题


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?


回答1:


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);
    }
}



回答2:


<soap:Body> 
    <platformMsgs:getSelectValue> 
      <platformMsgs:fieldDescription> 
        <platformCore:recordType>salesOrder</platformCore:recordType> 
        <platformCore:field>shipMethod</platformCore:field> 
      </platformMsgs:fieldDescription> 
      <platformMsgs:pageIndex>0</platformMsgs:pageIndex> 
    </platformMsgs:getSelectValue> 
</soap:Body> 


来源:https://stackoverflow.com/questions/21261624/how-to-list-shipping-methods-on-netsuite

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!