如何通过SOAP通过位置名称列表搜索NetSuite位置

时间:2018-10-11 01:37:39

标签: soap netsuite

我正在尝试通过SOAP通过位置名称列表搜索NetSuite位置记录。根据{{​​3}},搜索列“名称”具有“文本”类型而不是列表,因此我尝试改用“ getList”方法。

根据消息文档,getList模式如下:

<complexType name="GetListRequest">
    <sequence>
        <element name="baseRef" type="platformCore:BaseRef" minOccurs="1" maxOccurs="unbounded"/>
    </sequence>
</complexType>

,BaseRef文档如下:

<complexType name="BaseRef" abstract="true">
    <sequence>
        <element name="name" type="xsd:string" minOccurs="0"/>
        <!-- record name -->
    </sequence>
</complexType>

因此,我构建了SOAP正文:

<soap:Body>
    <platformMsgs:getList xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com"  xmlns:listRel="urn:relationships_2016_2.lists.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2016_2.platform.webservices.netsuite.com"    xmlns:listAcct="urn:accounting_2016_2.lists.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
        <platformMsgs:baseRef xsi:type="platformCore:RecordRef" type="location">
            <platformCore:name>some name</platformCore:name>
        </platformMsgs:baseRef>
    </platformMsgs:getList>
</soap:Body>

并收到错误消息:

<soapenv:Body>
    <getListResponse xmlns="urn:messages_2016_2.platform.webservices.netsuite.com">
        <readResponseList>
            <platformCore:status isSuccess="true" xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com"/>
            <readResponse>
                <platformCore:status isSuccess="false" xmlns:platformCore="urn:core_2016_2.platform.webservices.netsuite.com">
                    <platformCore:statusDetail type="ERROR">
                        <platformCore:code>INVALID_KEY_OR_REF</platformCore:code>
                        <platformCore:message>The specified key is invalid.</platformCore:message>
                    </platformCore:statusDetail>
                </platformCore:status>
            </readResponse>
        </readResponseList>
    </getListResponse>
</soapenv:Body>

我想我对getList方法的使用一定有所误解,但我无法通过搜索Google或StackOverflow找到答案,非常感谢您提供任何信息和建议,谢谢!很抱歉,由于我的信誉得分低,这些图片无法显示为嵌入式。

1 个答案:

答案 0 :(得分:0)

您无法过滤getList命令。相反,您需要运行LocationSearchBasichere's the documentation),该过滤器允许您按名称进行过滤。

以下是如何使用NetSuite ruby gem生成此搜索的示例:

search = NetSuite::Records::Location.search(
  basic: [
    {
      field: 'name',
      operator: 'is',
      value: 'some name'
    }
  ]
)

search.results