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.

Rookie Asked on September 30, 2019 in SuiteScript.
Add Comment
2 Answer(s)

I find this difficult to believe as well, but I do not see this as being supported on Item records/search.   page 61 shows search types that support File join results and item is not listed.

Intermediate Answered on October 1, 2019.
Add Comment

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

  type: ITEM_TYPE,
  column: ['file.url', '', '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.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.
  • This site made possible by our sponsors:   Tipalti   Celigo   Limebox   Become a Sponsor   Become a Sponsor