Monday, January 28, 2019

WS > Get Custom Tabs on Customer Record via PHP

- To search Child custom Records (Any Custom Record)  of the Parent Record (Customer) via PHP, refer to the sample code below :

require_once '../PHPToolkit/NetSuiteService.php';

$service = new NetSuiteService();

$recTypeId = 159; //Custom Record type internal id
$customerId = 5190; //Customer internal id

$search = new CustomRecordSearchBasic();
$search->recType = array('internalId' => $recTypeId);

$custSearchField = new SearchMultiSelectCustomField();
$custSearchField->internalId = "custrecord_customer_fieldvalue"; //Internal id of field marked 'record is parent'
$custSearchField->operator = "anyOf";
$custSearchField->searchValue = array('internalId' => $customerId);

$search->customFieldList->customField = $custSearchField;

$search->externalId = $customerIdField;

$request = new SearchRequest();
$request->searchRecord = $search; 

$searchResponse = $service->search($request);

if (!$searchResponse->searchResult->status->isSuccess) {
    echo "SEARCH ERROR";
} else {
    echo "SEARCH SUCCESS, records found: " . $searchResponse->searchResult->totalRecords . "<br>";
    $records = $searchResponse->searchResult->recordList;
    foreach ($records as $record)  {
                foreach ($record as $subrecord)  {
                                echo "Name: " . $subrecord->internalId . "<br>";


DISCLAIMER: The sample code described herein is provided on an "as is" basis, without warranty of any kind, to the fullest extent permitted by law. Netsuite Inc. does not warrant or guarantee the individual success developers may have in implementing the sample code on their development platforms or in using their own Web server configurations.

Netsuite Inc. does not warrant, guarantee or make any representations regarding the use, results of use, accuracy, timeliness or completeness of any data or information relating to the sample code. Netsuite Inc. disclaims all warranties, express or implied, and in particular, disclaims all warranties of merchantability, fitness for a particular purpose, and warranties related to the code, or any service or software related thereto.

Netsuite Inc. shall not be liable for any direct, indirect or consequential damages or costs of any type arising out of any action taken by you or others related to the sample code.

No comments:

Post a Comment