gpt4 book ai didi

c# - 返回的 NetSuite 事务搜索没有任何发票行项目

转载 作者:行者123 更新时间:2023-11-30 14:58:35 24 4
gpt4 key购买 nike

我正在尝试将发票从 NetSuite 导入到我的程序中。在这个程序中,我需要尽可能多的关于要退回的发票的信息。但是,似乎没有返回任何行项目信息。这是我为搜索完成的代码。有什么建议么?我正在尝试通过尽可能少地调用 NetSuite 来完成此操作,以保持高性能。

SearchResult searchResults = new SearchResult();

TransactionSearch ts = new TransactionSearch();
TransactionSearchBasic tsb = new TransactionSearchBasic();

// Search for Invoices
if (_InvoiceTxnIds.Count > 0)
{
tsb.internalId = new SearchMultiSelectField();
tsb.internalId.@operator = SearchMultiSelectFieldOperator.anyOf;
tsb.internalId.operatorSpecified = true;

List<RecordRef> rrlist = new List<RecordRef>();
foreach (string sTxnId in _InvoiceTxnIds)
{
RecordRef rr = new RecordRef();
rr.internalId = sTxnId;
rrlist.Add(rr);
}

tsb.internalId.searchValue = rrlist.ToArray();

ts.basic = tsb;

searchResults = _service.search(ts);
}

最佳答案

我在“Suite Talk Web 服务平台指南”中找到了我的答案:

SuiteTalkWebServicesPlatformGuid_2012.1.pdf (Page 34, Setting Search Preferences.)

我在下面包含了我的解决方案和代码,以防将来该指南不可用。

bodyFieldsOnly
boolean
Defaults to TRUE and indicates that the information in the body fields of the record are returned — significantly improving performance. Any fields in associated lists or sublists are not returned. If the bodyFieldsOnly field is set to FALSE, all fields associated with the record are returned.

所以我没有将 bodyFieldsOnly 设置为 false。一旦设置为 false 然后我得到了所需的全部信息。

/// <summary>
/// <p>This function builds the Pereferences and SearchPreferences in the SOAP header. </p>
/// </summary>
private void setPreferences()
{
// Set up request level preferences as a SOAP header
_prefs = new Preferences();
_service.preferences = _prefs;
_searchPreferences = new SearchPreferences();
_service.searchPreferences = _searchPreferences;

// Preference to ask NS to treat all warnings as errors
_prefs.warningAsErrorSpecified = true;
_prefs.warningAsError = false;
_searchPreferences.pageSize = _pageSize;
_searchPreferences.pageSizeSpecified = true;
// Setting this bodyFieldsOnly to true for faster search times on Opportunities
_searchPreferences.bodyFieldsOnly = false;
}

关于c# - 返回的 NetSuite 事务搜索没有任何发票行项目,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18599612/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com