RE: Suitescript get file ID that attached to an item record

This is a long shot because I don’t know that it can be done.

We attach PDF files to our item records and I would like a way to send those in an email.  It does not appear that there is any way to get the file id attached to an item record.  This is under communications, files.

What boggles the mind is how does NetSuite know which file is attached to the record yet there is no way to retrieve it??

Thanks for any help.

BrianCDP Rookie Asked on September 30, 2019 in SuiteScript.
Add Comment
2 Answers

You can create a search on item with column with joinId as file and fetch name, url or inernalid like below,

search.lookupFields({
  type: ITEM_TYPE,
  id: NS_INTERNAL_ID,
  column: ['file.url', 'file.name', 'file.internalid']
});
Beginner Answered on October 1, 2019.

Hello,   Have you bee able to have your example work? 

I get:

“type”:”error.SuiteScriptError”,”name”:”SSS_INVALID_SRCH_COLUMN_JOIN”,”message”:”An nlobjSearchColumn contains an invalid column join ID, or is not in proper syntax: id.”  

Here is my search:

var f = search.lookupFields({
type: search.Type.ITEM, 
id: 730, 
columns: ['file.id','file.name','file.url']  });
on October 1, 2019.

There is no column named id it is internalid. The error message too was self explanatory 🙂

on October 3, 2019.

If there is more than one file attached to the record, how do you get the id of each one?

on August 12, 2021.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.