Can anyone please help with how to get a list of ...
# general
b
Can anyone please help with how to get a list of `VendorPayment`s by a
Vendor
entity from SuiteTalk.
For anyone that may need this in the future
/// <summary> /// Gets the complete list of VendorPayment records by vendor in NetSuite using the search() operation. /// </summary> public async Task<IEnumerable<VendorPayment>> Get(string vendorId) { var transactionSearchAdvanced = new TransactionSearchAdvanced(); transactionSearchAdvanced.columns = new TransactionSearchRow(); transactionSearchAdvanced.columns.basic = new TransactionSearchRowBasic { dateCreated = new SearchColumnDateField[] { new SearchColumnDateField() }, tranDate = new SearchColumnDateField[] { new SearchColumnDateField() }, type = new SearchColumnEnumSelectField[] { new SearchColumnEnumSelectField() }, tranId = new SearchColumnStringField[] { new SearchColumnStringField() }, internalId = new SearchColumnSelectField[] { new SearchColumnSelectField() }, entity = new SearchColumnSelectField[] { new SearchColumnSelectField() }, item = new SearchColumnSelectField[] { new SearchColumnSelectField() }, lastModifiedDate = new SearchColumnDateField[] { new SearchColumnDateField() } }; transactionSearchAdvanced.criteria = new TransactionSearch(); transactionSearchAdvanced.criteria.basic = new TransactionSearchBasic(); transactionSearchAdvanced.criteria.basic.mainLine = new SearchBooleanField(); transactionSearchAdvanced.criteria.basic.mainLine.searchValue = true; transactionSearchAdvanced.criteria.basic.mainLine.searchValueSpecified = true; transactionSearchAdvanced.criteria.basic.type = new SearchEnumMultiSelectField(); transactionSearchAdvanced.criteria.basic.type.@operator = SearchEnumMultiSelectFieldOperator.anyOf; transactionSearchAdvanced.criteria.basic.type.operatorSpecified = true; transactionSearchAdvanced.criteria.basic.type.searchValue = new string[] { "_vendorPayment" }; transactionSearchAdvanced.criteria.basic.entity = new SearchMultiSelectField(); transactionSearchAdvanced.criteria.basic.entity.searchValue = new RecordRef[] { GenerateRecordRef(vendorId, RecordType.vendor) }; transactionSearchAdvanced.criteria.basic.entity.@operator = SearchMultiSelectFieldOperator.anyOf; transactionSearchAdvanced.criteria.basic.entity.operatorSpecified = true; var searchResult = await _client.searchAsync(transactionSearchAdvanced); var records = searchResult.searchRowList; List<VendorPayment> vendorPaymentList = new List<VendorPayment>(); foreach (var record in records) { //vendorPaymentList.Add((VendorPayment)record); } return vendorPaymentList; }