NetSuite Development Notes
Tuesday, December 18, 2018
PHP Toolkit 2012.2 Sample Code: Update a custom record
Below is a sample code to update a custom record using PHP Toolkit 2012.2
<?phprequire_once '../NSPHPClient/NetSuiteService.php';$service = new NetSuiteService();//add a new record for a custom record type//create an instance of the fields of the custom record $customStringFieldList = new StringCustomFieldRef();$customStringFieldList->internalId = "custrecord_name";$customStringFieldList->value = "Test from PHP toolkit";$customSelectFieldList = new SelectCustomFieldRef();$customSelectFieldList->value = new ListOrRecordRef();$customSelectFieldList->value->internalId = 5;$customSelectFieldList->internalId = 'custrecord_payment_method';$basicCustomRecord = new CustomRecord();$basicCustomRecord->name = "PHP Toolkit 2012.2";$basicCustomRecord->internalId = "7"; // internal id of the custom record you want to update$basicCustomRecord->recType = new RecordRef();$basicCustomRecord->recType->internalId = "14"; // Record Type's internal ID (Setup > Customization > Record Types > Basic Record Type (Internal ID=14)$basicCustomRecord->customFieldList = new CustomFieldList();$basicCustomRecord->customFieldList->customField = array($customStringFieldList, $customSelectFieldList);$updateRequest = new UpdateRequest();$updateRequest->record = $basicCustomRecord;$updateResponse = $service->update($updateRequest);var_dump($updateResponse);if (!$updateResponse->writeResponse->status->isSuccess) { echo "UPDATE ERROR"; exit();} else { echo "UPDATE SUCCESS, id " . $updateResponse->writeResponse->baseRef->internalId;}?>
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment