java - How to get client list using SOAP Web Services in Netsuite ERP? -
i new soap web services , netsuite erp , trying generate report in company need obtain clients , invoices using data available in netsuite erp. followed java , axis tutorial offer sample app erp , created java project in eclipse consumes wsdl netsuite 2015-2 , compiles needed classes run sample app. so, followed example found in crm exapmle app obtain client's information problem example method needs introduce client's id. here sample code:
public int getcustomerlist() throws remoteexception, exceededusagelimitfault, unexpectederrorfault, invalidsessionfault, exceededrecordcountfault, unsupportedencodingexception { // operation requires valid session this.login(true); // prompt list of internalids , put in array _console .write("\ninternalids records retrieved (separated commas): "); string reqkeys = _console.readln(); string[] internalids = reqkeys.split(","); return getcustomerlist(internalids, false); } private int getcustomerlist(string[] internalids, boolean isexternal) throws remoteexception, exceededusagelimitfault, unexpectederrorfault, invalidsessionfault, exceededrecordcountfault { // build array of recordref objects , invoke getlist() // operation retrieve these records recordref[] recordrefs = new recordref[internalids.length]; (int = 0; < internalids.length; i++) { recordref recordref = new recordref(); recordref.setinternalid(internalids[i]); recordrefs[i] = recordref; recordrefs[i].settype(recordtype.customer); } // invoke getlist() operation readresponselist getresponselist = _port.getlist(recordrefs); // process response get() operation if (!isexternal) _console.info("\nrecords returned getlist() operation: \n"); int numrecords = 0; readresponse[] getresponses = getresponselist.getreadresponse(); (int = 0; < getresponses.length; i++) { _console.info("\n record[" + + "]: "); if (!getresponses[i].getstatus().isissuccess()) { _console.errorforrecord(getstatusdetails(getresponses[i] .getstatus())); } else { numrecords++; customer customer = (customer) getresponses[i].getrecord(); _console.info(" internalid=" + customer.getinternalid() + "\n entityid=" + customer.getentityid() + (customer.getcompanyname() == null ? "" : ("\n companyname=" + customer .getcompanyname())) + (customer.getentitystatus() == null ? "" : ("\n status=" + customer.getentitystatus().getname())) + (customer.getemail() == null ? "" : ("\n email=" + customer.getemail())) + (customer.getphone() == null ? "" : ("\n phone=" + customer.getphone())) + "\n isinactive=" + customer.getisinactive() + (customer.getdatecreated() != null ? "" : ("\n datecreated=" + customer .getdatecreated().tostring()))); } } return numrecords; }
so can see, method needs internal id of each customer find not useful have many customers , don't want pass each customer's id. read api docs (which find hard navigate , kind of useless) , found web service called getall() gives records given getallrecord object requires getallrecordtype object. however, getallrecordtype object not support customer entities, can't obtain customers on erp way.
is there easy way obtain customers in netsuite erp (maybe using other thing rather soap web services offer? desperate situation understanding how netsuite's web services api has been troublesome.
thanks!
you use search select list of customers. on large account not customers on regular basis. if trying invoices might find more practical search.
you wrote "in company". trying write application of sort? if internal project (and if it's not) you'll find using suitescripts more efficient in terms of time , frustration level.
Comments
Post a Comment