Deepak Garg
Deepak Garg

Reputation: 142

In Netsuite not able to access the file under 'Communication' tab through suitscript

In netsuite we have 'Communication' Tab in records. Like in my case 'Vendor Bill' record. Under 'Communication' Tab we have 'Files' subtab where user can upload the files related to that record.

I want to access that 'Files' tab with suitscript but it is not visible. I have used nlapiLoadRecord to load the record of vendor bill and the check the record but communication tab is not present.

From where I can access those files or netsuite doesn't provide the support for that ?

Upvotes: 0

Views: 1419

Answers (1)

Mike Robbins
Mike Robbins

Reputation: 3287

Files are not available via sublists on transactions. Enhancement request #187429 has been opened to address this. In the meantime, you can access the files attached to a given record with a search like this:

function getAttachedFileIds(recordType, recordId) {
    var fileIds = nlapiSearchRecord(recordType, null, [
        new nlobjSearchFilter('internalid', null, 'anyof', recordId),
        new nlobjSearchFilter('mainline', null, 'is', 'T')
    ], [
        new nlobjSearchColumn('internalid', 'file'),
        new nlobjSearchColumn('name', 'file')
    ]);

    return (fileIds || []).map(function(file) {
        return {
            id: file.getValue('internalid', 'file'),
            name: file.getValue('name', 'file')
        }
    });
}

var fileIds = getAttachedFileIds('expensereport', 3408401);

After you get your list of file IDs you can load them as needed with nlapiLoadFile().

Upvotes: 4

Related Questions