Customer association with Netsuite File in PHP

58 Views Asked by At

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. enter image description here

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.

0

There are 0 best solutions below