Tuesday, September 18, 2018

Web Services > Joined Search Sample using PHP Toolkit


Search using NoteSearch and Joined with a transaction Internal Id to get the notes of a specific Sales Order record.

Sample code snippet in PHP:

<?php
require_once '../PHPtoolkit.php';
require_once 'login_info.php';

global $myNSclient;

$noteSearch = new nsComplexObject("NoteSearch");
$noteSearch->setFields(array("transactionJoin" =>
         array("internalId" =>
         array("operator" => "anyOf","searchValue" =>
         array("internalId"=>"299","type"=>"salesOrder")))));

 $getResponse = $myNSclient->search($noteSearch);

 print_r($getResponse);
?>

 

 

Equivalent SOAP request and response:

SOAP REQUEST:
   <soapenv:Body>
      <platformMsgs:search
          xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"
          xmlns:platformCore="urn:core_2009_2.platform.webservices.netsuite.com"
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xmlns:s0="urn:communication_2009_2.general.webservices.netsuite.com"
          xmlns:platformCommon="urn:common_2009_2.platform.webservices.netsuite.com"
          xmlns:platformMsgs="urn:messages_2009_2.platform.webservices.netsuite.com">
         <platformMsgs:searchRecord xsitype="s0:NoteSearch">
            <s0:transactionJoin>
               <platformCommon:internalId operator="anyOf">
                  <searchValue internalId="299" type="salesOrder" />
              
</platformCommon:internalId>

           
</s0:transactionJoin>

        
</platformMsgs:searchRecord>

     
</platformMsgs:search>

  
</soapenv:Body>

SOAP RESPONSE:
   <soapenv:Body>
      <searchResponse xmlns="urn:messages_2009_2.platform.webservices.netsuite.com">
         <searchResult xmlns:platformCore="urn:core_2009_2.platform.webservices.netsuite.com">
            <status isSuccess="true" />
            <totalRecords>1</totalRecords>
            <pageSize>1000</pageSize>
            <totalPages>1</totalPages>
            <pageIndex>1</pageIndex>
            <searchId>WEBSERVICES_TSTDRV594041_062320101721955677588810515_551803e</searchId>
            <recordList>
               <record internalId="9" xsitype="generalComm:Note"
                   xmlns:generalComm="urn:communication_2009_2.general.webservices.netsuite.com">
                  <generalComm:title>erwin luke notes</generalComm:title>
                  <generalComm:noteType internalId="8">
                     <name>Phone Call</name>
                 
</generalComm:noteType>

                  <generalComm:direction>_outgoing</generalComm:direction>
                  <generalComm:noteDate>2010-06-24T05:03:00.000-07:00</generalComm:noteDate>
                  <generalComm:note>erl notes</generalComm:note>
                  <generalComm:lastModifiedDate>2010-06-23T14:03:32.000-07:00</generalComm:lastModifiedDate>
                  <generalComm:author internalId="-5">
                     <name>EE100003</name>
                 
</generalComm:author>

                  <generalComm:entity internalId="52">
                     <name>10002</name>
                 
</generalComm:entity>

                  <generalComm:transaction internalId="299">
                     <name>Sales Order #50</name>
                 
</generalComm:transaction>

              
</record>

           
</recordList>

        
</searchResult>

     
</searchResponse>

  
</soapenv:Body>

 

No comments:

Post a Comment