The purpose here is to upload a file to the Netsuite File Cabinet using the PHP Netsuite client, associate the uploaded file with the client and display it in the files area.
I can create the file, but I cannot associate it with the customer.
What I have so far:
function addFileToCustomer($customerId, $filePath, $fileName, $fileType, $folderInternalId)
{
$service = new NetSuiteService();
if (file_exists($filePath)) {
$file = new File();
$contentFile = file_get_contents($filePath);
$file->content = $contentFile;
$file->name = $fileName;
$file->fileType = $fileType;
$folder = new RecordRef();
$folder->internalId = $folderInternalId;
$file->folder = $folder;
$file->isOnline = true;
$file->mediaFile = true;
$request = new AddRequest();
$request->record = $file;
$service->add($request);
}
}
After creating a file and associating it with the customer, I want to add it to the file list under communication on the customer page.