Tuesday, February 26, 2019

PHP > 2012.2 Toolkit > Get the Results of an Asynchronous Web Services Request based on user request

This sample code will get the Results of an Asynchronous Web Services Request and display the results when the user wants it.
Please note the login credientials are on the NsConfig.php file

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

//Creates the NetSuite Service object to perform the operations
$service = new NetSuiteService();

//Hard coded the job ID retrieved from Process Status (Setup > Integration > Web Services Process Status)
$jobId="ASYNCWEBSERVICES_TSTDRV945834_0513201316129973012141268339_8";

//All the required to perform a getAsyncResult operation
$getResults = new GetAsyncResultRequest();
$getResults->jobId = $jobId;
$getResults->pageIndex = 1;

//Process the request and store it in a variable
$results = $service->getAsyncResult($getResults);

// Display the results returned .
echo print_r($results);

?>

No comments:

Post a Comment