c# - How to get Credit Card Memo data from Netsuite TransactionSearchAdvanced? -
i'm newbie netsuite's api.
i'm trying credit memo data (invoice or vendor payment also) transactionsearchadvanced.
here code :
public void getcreditlist() { transactionsearchadvanced tsa = new transactionsearchadvanced(); tsa.columns = new transactionsearchrow(); tsa.columns.basic = new transactionsearchrowbasic(); tsa.columns.basic.tranid = new searchcolumnstringfield[] { new searchcolumnstringfield() }; tsa.criteria = new transactionsearch(); tsa.criteria.basic = new transactionsearchbasic(); tsa.criteria.basic.mainline = new searchbooleanfield(); tsa.criteria.basic.mainline.searchvalue = true; tsa.criteria.basic.mainline.searchvaluespecified = true; tsa.criteria.basic.type = new searchenummultiselectfield(); tsa.criteria.basic.type.@operator = searchenummultiselectfieldoperator.anyof; tsa.criteria.basic.type.operatorspecified = true; tsa.criteria.basic.type.searchvalue = new string[] { "_creditmemo" }; this.login(true); searchresult response = _service.search(tsa); // process response if (response.status.issuccess) { if (response.totalrecords > 0) { (int = 1; <= response.totalpages; i++) { processcreditmemosearchresponse(response); } } else { _out.info("\nnothing found."); } } else { //_out.error(getstatusdetails(response.status)); } console.readline(); } private void processcreditmemosearchresponse(searchresult response) { _out.info("\nthe search() operation customers run successfully."); _out.info("\n total records = " + response.totalrecords); _out.info(" total pages = " + response.totalpages); _out.info(" page size = " + response.pagesize); _out.info(" current page index = " + response.pageindex); //record[] records = response.recordlist; searchrow[] records = response.searchrowlist; creditmemo creditmemo; (int = 0, j = (response.pageindex - 1) * _pagesize; < records.length; i++, j++) { creditmemo = (creditmemo)records[i]; _out.info( "\n record[" + j + "]: " + "\n internalid=" + creditmemo.internalid); } }
and error " cannot convert searchrow creditmemo"
i don't know have next.
any hint appreciate !! thank !
i found own solution !
public void getinvoicelist() { transactionsearch transactionssearch = new transactionsearch(); transactionsearchbasic transactionsearchbasic = new transactionsearchbasic(); transactionsearchbasic.type = new searchenummultiselectfield(); transactionsearchbasic.type.@operator = searchenummultiselectfieldoperator.anyof; transactionsearchbasic.type.operatorspecified = true; transactionsearchbasic.type.searchvalue = new string[] { "_invoice" }; transactionssearch.basic = transactionsearchbasic; this.login(true); searchresult result = _service.search(transactionssearch); list<invoice> invoicelist = new list<invoice>(); if (result.status.issuccess) { //recordlist recordlist = result.recordlist; record[] records = result.recordlist; if (records != null && records.length != 0) { (int = 0; < records.length; i++) { invoice invoice = (invoice)records[i]; invoicelist.add(invoice); } } } console.readline(); }
Comments
Post a Comment