This topic contains 2 replies, has 0 voices, and was last updated by chuckles 8 years, 10 months ago.
- 
		AuthorPosts
- 
December 9, 2015 at 11:04 am #6811
 chucklesSorry guys and gals, Having a senior moment. In C#, webservices… trying to select all open invoices by a specific customer..Think I’ve got all of the other parts in place, just can’t remember how to select a specific customer by internal id. Any help out there? Thanks in advance 
 This is a cached copy. Click here to see the original post.
- 
December 10, 2015 at 2:54 am #6812
 ashishshuklaHi, Here is the C# code – private List GetCustomerSpecificOpenInvoices(string customerId) { TransactionSearch invoiceSearch = new TransactionSearch(); TransactionSearchBasic invoiceSearchBasic = new TransactionSearchBasic(); SearchEnumMultiSelectField invoiceStatus = new SearchEnumMultiSelectField(); string[] statusArray = new string[1]; statusArray[0] = “_invoiceOpen”; invoiceStatus.searchValue = statusArray; invoiceStatus.@operator = SearchEnumMultiSelectFieldOperator.anyOf; invoiceStatus.operatorSpecified = true; invoiceSearchBasic.status = invoiceStatus; SearchEnumMultiSelectField recType = new SearchEnumMultiSelectField(); string[] transactioType = new string[1]; transactioType[0] = “_invoice”; recType.searchValue = transactioType; recType.@operator = SearchEnumMultiSelectFieldOperator.anyOf; recType.operatorSpecified = true; invoiceSearchBasic.type = recType; if (!string.IsNullOrEmpty(customerId)) { SearchMultiSelectField customer = new SearchMultiSelectField(); RecordRef customerRef = new RecordRef(); customerRef.internalId = customerId; customerRef.type = RecordType.customer; customerRef.typeSpecified = true; RecordRef[] customerRefArray = new RecordRef[1]; customerRefArray[0] = customerRef; customer.searchValue = customerRefArray; invoiceSearchBasic.entity = customer; } SearchPreferences pref = new SearchPreferences(); pref.bodyFieldsOnly = false; objService.searchPreferences = pref; invoiceSearch.basic = invoiceSearchBasic; Invoice invoiceRecord = null; List invoiceRange = new List(); SearchResult invoiceResults = objService.search(invoiceSearch); if (invoiceResults.status.isSuccess == true && invoiceResults.status.isSuccessSpecified == true) { if (invoiceResults != null) { for (var i = 0; i < invoiceResults.recordList.Length; i++) { invoiceRecord = (Invoice)invoiceResults.recordList[i]; invoiceRange.Add(invoiceRecord); } } } return invoiceRange; } 
- 
December 30, 2015 at 1:16 pm #6813
 chucklesthanks very much for your response 
- 
		AuthorPosts
You must be logged in to reply to this topic.
