Friday, June 28, 2019

Web Services > Sample PHP Code in Adding a Support Case

Below is a sample PHP code in creating a Support Case record via Web Services. For the particular sample below, it just sets the value for the Company and Title fields.

<?php

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

$service = new NetSuiteService();

$case = new SupportCase();
$case->company = new RecordRef();
$case->company->internalId = "332";   //internal ID of company
$case->title = "Test Case";    //title of case
$request = new AddRequest();
$request->record = $case;

$addResponse = $service->add($request);

if (!$addResponse->writeResponse->status->isSuccess) {
    echo "ADD ERROR";
} else {
    echo "ADD SUCCESS, id " . $addResponse->writeResponse->baseRef->internalId;
}

?>

For more information on the available fields and records in Web Services, please refer to the SuiteTalk Schema Browser

No comments:

Post a Comment