Sunday, September 16, 2018

Web Services > .NET > Search Join example for Customers andContact records

The following code will search for a contact record with constraints and joining the customer record in the search.

 

This is a sample code in .NET on how to use the search join method using webservices.

 

ContactSearch contact = new ContactSearch();

SearchStringField strEmail = new SearchStringField();

strEmail.@operator = SearchStringFieldOperator.@is;

strEmail.operatorSpecified = true;

strEmail.searchValue = "testaccount@netsuite.com";

ContactSearchBasic contactSB = new ContactSearchBasic();

contactSB.email = strEmail;

contact.basic = contactSB;

SearchStringField strEntityId = new SearchStringField();

strEntityId.@operator = SearchStringFieldOperator.@is;

strEntityId.operatorSpecified = true;

strEntityId.searchValue = "EMPL05";

CustomerSearchBasic customerSB = new CustomerSearchBasic();

customerSB.entityId = strEntityId;

contact.customerJoin = customerSB;

_service.search(contact);

 

 

 

Equivalent SOAP request:

 

<Envelope>

  <Body>

   <search>

    <searchRecord type="ContactSearch">

     <basic>

       <email operator="is">

        <searchValue>testaccount@netsuite.com</searchValue>

       </email>

     </basic>

     <customerJoin>

      <entityId operator="is">

       <searchValue>EMPL05</searchValue>

      </entityId>

     </customerJoin>

    </searchRecord>

   </search>

  </Body>

</Envelope>

 

No comments:

Post a Comment