使用NetSuite WebServices引用现有已保存的搜索时,提取公式(文本)字段

时间:2016-09-19 09:32:01

标签: web-services netsuite

我正在尝试使用webservices提取NetSuite保存的搜索结果。在响应中,我只看到正常字段(在“结果”部分中输入),而不是“公式”(“文本”)字段。

以下是已保存搜索结果部分的图片。

Saved search results section with Formula (Text)

以下是发送给NetSuite的请求。

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"  xmlns:tns="urn:platform_2014_2.webservices.netsuite.com" xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com" xmlns:platformFaults="urn:faults_2014_2.platform.webservices.netsuite.com">
<soap:Header>
    <urn5:preferences xmlns:urn5="urn:messages_2014_2.platform.webservices.netsuite.com">
        <urn6:warningAsError xmlns:urn6="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn6:warningAsError>
        <urn7:disableMandatoryCustomFieldValidation xmlns:urn7="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn7:disableMandatoryCustomFieldValidation>
        <urn7:ignoreReadOnlyFields xmlns:urn7="urn:messages_2014_2.platform.webservices.netsuite.com">false</urn7:ignoreReadOnlyFields>
    </urn5:preferences>
    <urn8:searchPreferences xmlns:urn8="urn:messages_2014_2.platform.webservices.netsuite.com">
        <urn9:bodyFieldsOnly xmlns:urn9="urn:messages_2014_2.platform.webservices.netsuite.com">true</urn9:bodyFieldsOnly>
        <urn10:pageSize xmlns:urn10="urn:messages_2014_2.platform.webservices.netsuite.com">1000</urn10:pageSize>
        <urn11:returnSearchColumns xmlns:urn11="urn:messages_2014_2.platform.webservices.netsuite.com">true</urn11:returnSearchColumns>
    </urn8:searchPreferences>
</soap:Header>
<soap:Body>
    <platformMsgs:search xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com" xmlns="urn:messages_2014_2.platform.webservices.netsuite.com">
        <platformMsgs:searchRecord xsi:type="ns1:CustomerSearchAdvanced" xmlns:ns1="urn:relationships_2014_2.lists.webservices.netsuite.com" savedSearchId="2469"/>
    </platformMsgs:search>
</soap:Body>

我看到的回应如下。

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<soapenv:Header>
    <platformMsgs:documentInfo 
        xmlns:platformMsgs="urn:messages_2014_2.platform.webservices.netsuite.com">
        <platformMsgs:nsId>WEBSERVICES_TSTDRV840553_091920161097968934683523704_57aaf0b</platformMsgs:nsId>
    </platformMsgs:documentInfo>
</soapenv:Header>
<soapenv:Body>
    <searchResponse 
        xmlns="urn:messages_2014_2.platform.webservices.netsuite.com">
        <platformCore:searchResult 
            xmlns:platformCore="urn:core_2014_2.platform.webservices.netsuite.com">
            <platformCore:status isSuccess="true"/>
            <platformCore:totalRecords>2</platformCore:totalRecords>
            <platformCore:pageSize>1000</platformCore:pageSize>
            <platformCore:totalPages>1</platformCore:totalPages>
            <platformCore:pageIndex>1</platformCore:pageIndex>
            <platformCore:searchId>WEBSERVICES_TSTDRV840553_091920161097968934683523704_57aaf0b</platformCore:searchId>
            <platformCore:searchRowList>
                <platformCore:searchRow xsi:type="listRel:CustomerSearchRow" 
                    xmlns:listRel="urn:relationships_2014_2.lists.webservices.netsuite.com">
                    <listRel:basic 
                        xmlns:platformCommon="urn:common_2014_2.platform.webservices.netsuite.com">
                        <platformCommon:comments>
                            <platformCore:searchValue>test</platformCore:searchValue>
                        </platformCommon:comments>
                        <platformCommon:entityId>
                            <platformCore:searchValue>test c 97161</platformCore:searchValue>
                        </platformCommon:entityId>
                        <platformCommon:entityStatus>
                            <platformCore:searchValue internalId="13"/>
                        </platformCommon:entityStatus>
                        <platformCommon:internalId>
                            <platformCore:searchValue internalId="59951"/>
                        </platformCommon:internalId>
                    </listRel:basic>
                </platformCore:searchRow>
                <platformCore:searchRow xsi:type="listRel:CustomerSearchRow" 
                    xmlns:listRel="urn:relationships_2014_2.lists.webservices.netsuite.com">
                    <listRel:basic 
                        xmlns:platformCommon="urn:common_2014_2.platform.webservices.netsuite.com">
                        <platformCommon:comments>
                            <platformCore:searchValue>test</platformCore:searchValue>
                        </platformCommon:comments>
                        <platformCommon:entityId>
                            <platformCore:searchValue>test c 97162</platformCore:searchValue>
                        </platformCommon:entityId>
                        <platformCommon:entityStatus>
                            <platformCore:searchValue internalId="13"/>
                        </platformCommon:entityStatus>
                        <platformCommon:internalId>
                            <platformCore:searchValue internalId="59952"/>
                        </platformCommon:internalId>
                    </listRel:basic>
                </platformCore:searchRow>
            </platformCore:searchRowList>
        </platformCore:searchResult>
    </searchResponse>
</soapenv:Body>

我也没有在NetSuite帮助指南中看到与此相关的任何解释/示例。

我们是否还有其他方式需要触发提取公式字段的请求?任何指针都会非常有用。

由于

1 个答案:

答案 0 :(得分:0)

我一直在研究这个相同的主题,我不相信Web服务支持结果集中的公式字段。似乎没有机制可以在静态定义的SOAP响应中返回它们。就我而言,我需要以下公式。

GREATEST({trandate},{lastmodifieddate},{linelastmodifieddate},{billingtransaction.trandate},{billingtransaction.lastmodifieddate},{billingtransaction.linelastmodifieddate})

它存在于我保存的搜索中,并且在从SuiteTalk引用时没有抛出错误。但是,公式字段在结果集中不作为列出现。我必须在保存的搜索中包含我的公式中使用的每个单独的字段,然后在代码中重新创建公式。

如果您需要将公式用作过滤条件的一部分(以应用于已保存的搜索),则需要在已保存的搜索本身中对其进行定义。您将无法通过SuiteTalk API应用基于公式的过滤器。

TransactionSearchAdvanced customSearch = new TransactionSearchAdvanced()
{
    savedSearchScriptId = "customsearch_[Your ID here]"
    ,
    criteria = new TransactionSearch()
    {
        [Formula fields are NOT supported here]
    }

};