Saturday, May 18, 2019

PHP Toolkit 2013.1 Sample Code: Create user note and attach to a record

<?php

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

$service = new NetSuiteService();

$note = new Note();
$note->title = "Rejection Note";
$note->noteType = 7;
$note->note = "This has been rejected for approval";

//user need to specify which record he/she want to associate the user note , in this example the note is associate to a transaction record such as "salesorder"
//if user would like to associate it to a contact or customer , he/she can use "entity" 
$note->transaction = new RecordRef();
$note->transaction->internalId = 10661; //internal id of the transaction record

$request = new AddRequest();
$request->record = $note;

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

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

?>

No comments:

Post a Comment