0

I am using suitetalk toolkit for accessing Netsuite. Already checked the samplecode,it has the code to get a promotion details by its internal Id(using getCustomer.php). I want to get All promotions from netsuite, to achieve this what could be the best way and how can i do that?

Already tried some hacks like through savedsearch, searchresults by giving promotions as the string. None of them led me to success.

Can anyone help me to find the way? i cant see any docs or online page to work with suitetalk operations for my requirement.

Code I have tried to get a Promotion

$service = new NetSuiteService();
$request = new GetRequest();
$request->baseRef = new RecordRef();
$request->baseRef->internalId = "3";//3183723
$request->baseRef->type = "promotionCode";//customer
$getResponse = $service->get($request);
print_r($getResponse);

if (!$getResponse->readResponse->status->isSuccess) {
    echo "GET ERROR";
} else {
    $promotion = $getResponse->readResponse->record;
    echo "Name :".$promotion->name."\n";
    echo "Start Date :".$promotion->startDate."\n";
    echo "End Date :".$promotion->endDate."\n";
    echo "Description :".$promotion->description."\n";
    echo "Rate :".$promotion->rate."\n";
}
Manikandan Arunachalam
  • 1,470
  • 3
  • 17
  • 32
  • As you have mentioned `from the sample code you can able to get a promotion details by its internal Id`, I'm pretty sure then you can retrieve all the promotions by removing the criteria that impose restriction only to internal id search. – Rockstar May 30 '16 at 04:18
  • Hey No.. I guess it is not. – Manikandan Arunachalam May 30 '16 at 04:45
  • Well, I dont have much idea on PHP side. But in suitescript we can simply comment out the filter condition on the internal id and can retrieve all the desired result. If you comment out `$request->baseRef->internalId = "3";//3183723` what error you see ? – Rockstar May 30 '16 at 05:21
  • Also you need to change your else block code, as there could be many results. You need to run a loop to fetch all the details. – Rockstar May 30 '16 at 05:23

1 Answers1

0

Use a search call, not a get call. Searches will return all rows paginated.

Suite Resources
  • 1,164
  • 8
  • 11