masterFly
masterFly

Reputation: 1112

NetSuite - Get Transaction (SO) by Customer Internal Id

I am trying to get SO records by the customer name OR InternalID. In the NetSuite response object I get the customer name in the entity key.

[entity] => RecordRef Object
        (
            [internalId] => 145498
            [externalId] => 
            [type] => 
            [name] => nameNameName
        )

Now I want to filter the SO records by the InternalID of customer, which is 145498.

In SQL what I want is, select * from Transactions where entity.internalId = 145498;

How can I do this?

Please help. Thanks in advance.

Upvotes: 2

Views: 1338

Answers (3)

Niraj Patel
Niraj Patel

Reputation: 115

You can filter so orders by this way select * from Transactions where entity= 145498 AND type=‘SalesOrd’

Here entity field refer to customer

Upvotes: 0

Rockstar
Rockstar

Reputation: 2288

Below is the code for searching a customer using PHP. You can replace the customer with your intend record type.

$service = new NetSuiteService();
$request = new GetRequest();
$request->baseRef = new RecordRef();
$request->baseRef->internalId = "21";
$request->baseRef->type = "customer";
$getResponse = $service->get($request);

if (!$getResponse->readResponse->status->isSuccess) {
    echo "GET ERROR";
} else {
    $customer = $getResponse->readResponse->record;
    echo "GET SUCCESS, customer:";
    echo "\nCompany name: ". $customer->companyName;
    echo "\nInternal Id: ". $customer->internalId;
    echo "\nEmail: ". $customer->email . "\n";
}

Hope that helps !

Upvotes: 1

Klitos Kyriacou
Klitos Kyriacou

Reputation: 11621

I can't help you with PHP but the following snippet of Java using Axis 1.4 to access SuiteTalk web services does what you're asking. Hopefully you can translate that into PHP:

    TransactionSearchBasic txnSrch = new TransactionSearchBasic();
    txnSrch.setRecordType(new SearchStringField(RecordType._salesOrder, SearchStringFieldOperator.is));
    txnSrch.setEntity(
            new SearchMultiSelectField(
                    new RecordRef[] {new RecordRef(null, "145498", null, null)},
                    SearchMultiSelectFieldOperator.anyOf
            )
    );

Upvotes: 1

Related Questions