I am attempting to use a Script to add item thumbn...
# advancedpdf
g
I am attempting to use a Script to add item thumbnail images to our Estimate and Invoice Advanced PDFs. I found this SuiteAnswer article that shows how to do it but I keep getting a "That record does not exist. path:" system error. I do get the correct URL to log to Debug but I can't find out what is causing the error. This is the code I am using as a USER EVENT that executes BEFORE SUBMIT FUNCTION:
Copy code
function getURLfromItem(type){
        var itemCount = nlapiGetLineItemCount('item');

        for (var i=1;i<=itemCount;i++)
        {
                nlapiSelectLineItem('item', i);
                var itemId = nlapiGetCurrentLineItemValue('item','item');
                var thumbnailUrl = nlapiLookupField('item',itemId,'custitem84');
                  var file = nlapiLoadFile(thumbnailUrl);
                  var imageUrl = file.getURL();
                  var completeUrl = '<https://system.netsuite.com>' + imageUrl;
                nlapiSetCurrentLineItemValue('item', 'custcol_item_thumbnail_url', completeUrl, true, true);
                nlapiCommitLineItem('item');
                  nlapiLogExecution('DEBUG','URL', completeUrl);
        }
}
The error occurs when trying to save a new estimate so that the script executes and generates the correct image URL. Please help!