web services - Convert NetSuite TransactionSearch into Advanced Search with only internalId column to return -
i've got ordinary transaction search, soap looks this:
<?xml version="1.0" encoding="utf-8"?> <search xsi:type="sales:transactionsearch" xmlns="urn:messages_2013_1.platform.webservices.netsuite.com" xmlns:sales="urn:sales_2013_1.transactions.webservices.netsuite.com" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:common="urn:common_2013_1.platform.webservices.netsuite.com" xmlns:core="urn:core_2013_1.platform.webservices.netsuite.com"> <sales:basic xsi:type="common:transactionsearchbasic" xmlns:common="urn:common_2013_1.platform.webservices.netsuite.com"> <common:type operator="anyof" xsi:type="core:searchenummultiselectfield"> <core:searchvalue xsi:type="xsd:string">_invoice</core:searchvalue> </common:type> <common:customfieldlist xsi:type="core:searchcustomfieldlist"> <core:customfield operator="anyof" xsi:type="core:searchmultiselectcustomfield" internalid="custbodyintegrationstatus"> <core:searchvalue xsi:type="core:listorrecordref" internalid="1" name="customlistintegrationstatuses"></core:searchvalue> </core:customfield> </common:customfieldlist> </sales:basic> </search>
this search works in production, when run search unexpected_error in result. guys netsuite recommended use advanced search instead. idea find invoices pre-defined value of custom field called custbodyintegrationstatus. custom field list of values , need select value internalid = "1". thing want in response internalid each found invoice. problem don't know how this. here's code (c#):
transactionsearchadvanced advancedsearchentity = new transactionsearchadvanced(); transactionsearch ts = new transactionsearch(); transactionsearchbasic tsb = new transactionsearchbasic(); // condition 1: on searchenummultiselectfield semsftrantype = new searchenummultiselectfield(); semsftrantype.operatorspecified = true; semsftrantype.@operator = searchenummultiselectfieldoperator.anyof; semsftrantype.searchvalue = new[]{"_salesorder"}; searchmultiselectcustomfield spsintegrationstatusfield = new searchmultiselectcustomfield(); spsintegrationstatusfield.operatorspecified = true; spsintegrationstatusfield.@operator = searchmultiselectfieldoperator.anyof; spsintegrationstatusfield.internalid = "custbodyintegrationstatus"; listorrecordref searchrecordentity = new listorrecordref(); searchrecordentity.name = "customlistintegrationstatuses"; searchrecordentity.internalid = "1"; // indicates record status - ready / test ready / etc spsintegrationstatusfield.searchvalue = new[] { searchrecordentity }; tsb.type = semsftrantype; tsb.customfieldlist = new searchcustomfield[] { spsintegrationstatusfield }; transactionsearchrow tsr = new transactionsearchrow(); transactionsearchrowbasic tsrb = new transactionsearchrowbasic(); searchcolumnselectfield[] selcols = new searchcolumnselectfield[1]; selcols[0] = new searchcolumnselectfield(); // set return columns tsrb.internalid = selcols; tsr.basic = tsrb; ts.basic = tsb; advancedsearchentity.criteria = ts; advancedsearchentity.columns = tsr; //note - columns defined above. _service.searchpreferences.returnsearchcolumns = true; searchresult savedsearchresult = _service.search(advancedsearchentity);
the soap request in webservices usage logs looks this:
<search xmlns="urn:messages_2013_1.platform.webservices.netsuite.com"> <searchrecord xsi:type="q1:transactionsearchadvanced" xmlns:q1="urn:sales_2013_1.transactions.webservices.netsuite.com"> <q1:criteria> <q1:basic> <type operator="anyof" xmlns="urn:common_2013_1.platform.webservices.netsuite.com"> <searchvalue xmlns="urn:core_2013_1.platform.webservices.netsuite.com">_salesorder</searchvalue> </type> <customfieldlist xmlns="urn:common_2013_1.platform.webservices.netsuite.com"> <customfield operator="anyof" internalid="custbodyintegrationstatus" xsi:type="searchmultiselectcustomfield" xmlns="urn:core_2013_1.platform.webservices.netsuite.com"> <searchvalue internalid="1"> <name>customlistintegrationstatuses</name> </searchvalue> </customfield> </customfieldlist> </q1:basic> </q1:criteria> <q1:columns> <q1:basic> <internalid xmlns="urn:common_2013_1.platform.webservices.netsuite.com"/> </q1:basic> </q1:columns> </searchrecord> </search>
and here's response:
<searchresponse xmlns="urn:messages_2013_1.platform.webservices.netsuite.com"> <platformcore:searchresult xmlns:platformcore="urn:core_2013_1.platform.webservices.netsuite.com"> <platformcore:status issuccess="true"/> <platformcore:totalrecords>108956</platformcore:totalrecords> <platformcore:pagesize>5</platformcore:pagesize> <platformcore:totalpages>21792</platformcore:totalpages> <platformcore:pageindex>1</platformcore:pageindex> <platformcore:searchid>webservices_tstdrv961603_060120141461034810519911044_b227f55</platformcore:searchid> <platformcore:searchrowlist> <platformcore:searchrow xsi:type="transales:transactionsearchrow" xmlns:transales="urn:sales_2013_1.transactions.webservices.netsuite.com"> <transales:basic xmlns:platformcommon="urn:common_2013_1.platform.webservices.netsuite.com"> <platformcommon:internalid> <platformcore:searchvalue internalid="134200"/> </platformcommon:internalid> </transales:basic> </platformcore:searchrow> <platformcore:searchrow xsi:type="transales:transactionsearchrow" xmlns:transales="urn:sales_2013_1.transactions.webservices.netsuite.com"> <transales:basic xmlns:platformcommon="urn:common_2013_1.platform.webservices.netsuite.com"> <platformcommon:internalid> <platformcore:searchvalue internalid="134200"/> </platformcommon:internalid> </transales:basic> </platformcore:searchrow> <platformcore:searchrow xsi:type="transales:transactionsearchrow" xmlns:transales="urn:sales_2013_1.transactions.webservices.netsuite.com"> <transales:basic xmlns:platformcommon="urn:common_2013_1.platform.webservices.netsuite.com"> <platformcommon:internalid> <platformcore:searchvalue internalid="134200"/> </platformcommon:internalid> </transales:basic> </platformcore:searchrow> <platformcore:searchrow xsi:type="transales:transactionsearchrow" xmlns:transales="urn:sales_2013_1.transactions.webservices.netsuite.com"> <transales:basic xmlns:platformcommon="urn:common_2013_1.platform.webservices.netsuite.com"> <platformcommon:internalid> <platformcore:searchvalue internalid="134200"/> </platformcommon:internalid> </transales:basic> </platformcore:searchrow> <platformcore:searchrow xsi:type="transales:transactionsearchrow" xmlns:transales="urn:sales_2013_1.transactions.webservices.netsuite.com"> <transales:basic xmlns:platformcommon="urn:common_2013_1.platform.webservices.netsuite.com"> <platformcommon:internalid> <platformcore:searchvalue internalid="134255"/> </platformcommon:internalid> </transales:basic> </platformcore:searchrow> </platformcore:searchrowlist> </platformcore:searchresult> </searchresponse>
it obvious i'm doing wrong, not unqueue internalids in search rows indicates that. so, tell me please wrong. both soap or c#/java/etc code sample helpful.
try adding search filter mainline = t remove duplicates. have record internalid =1?
Comments
Post a Comment