ec
08/20/2024, 6:02 PMCeligo AI
08/20/2024, 6:02 PMAI generated answer (using internal Slack threads):Based on the conversations, it appears that querying an image or a document in a custom field on an item using SuiteQL or N/query is not directly supported. You may encounter an error message like
UNSUITABLE - Unsupported data type 'IMAGE'
.
However, there is a workaround to this issue. You can use the search.lookupFields
method to get the ID of the image or document, and then use query.runSuiteQL
to get the name and filetype of the file from the file cabinet. Here is a sample code snippet:
javascript
var fieldLookUp = search.lookupFields({
type: search.Type.INVENTORY_ITEM,
id: item_id,
columns: ['name','internalid', 'custitem_atlas_item_image']
});
var img_id= fieldLookUp.custitem_atlas_item_image[0].value //7493
var queryResults = query.runSuiteQL(
{
query: "SELECT name, filetype FROM file WHERE id = "+ img_id
}
)
var imgq = queryResults.asMappedResults();
var img_filetype = imgq[0].filetype
var img_name = imgq[0].name
This code first looks up the image or document ID from the custom field on the item record, and then queries the file cabinet for the name and filetype of the file using that ID.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
08/20/2024, 6:02 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.881045163
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.850289345
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.836657524
Celigo AI
08/20/2024, 6:02 PMCeligo AI
08/20/2024, 6:33 PM