title: NetSuite - not able to reference images from folder
body: <p>My Code:</p>
  
  <pre><code>function combineExpenseFiles(type){
      try{
          var currentRecordId = nlapiGetRecordId();
          var currentRecord = nlapiLoadRecord('expensereport',currentRecordId);
          var expensesLineItemCount = currentRecord.getLineItemCount('expense');
          var template = '';
          var fileParts = new Array();
          template += '&lt;?xml version="1.0"?&gt;&lt;!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd"&gt;\n';
          template += '&lt;pdf&gt;\n&lt;head&gt;\n';
          template += '&lt;/head&gt;\n&lt;body&gt;\n';
          flag=1;
          for(var i=1;i&lt;=expensesLineItemCount;i++){
              var fileId = currentRecord.getLineItemValue('expense','expmediaitem',i);
              var file = nlapiLoadFile(fileId); 
              var name = file.getName();
  
              //var fileUrl = file.getURL();
  
              nlapiLogExecution('DEBUG','online',file.isOnline());
              var fileUrl = '/core/media/media.nl?id=36333&amp;c=3960047&amp;h=487697f81e113499d5f4';
              template += '&lt;img src="';
              template += nlapiEscapeXML(fileUrl);
              template += '" width="10%" height="10%"&gt;&lt;/img&gt;\n&lt;br&gt;&lt;/br&gt;&lt;br&gt;&lt;/br&gt;';
              break;
          }
          template += '&lt;/body&gt;\n&lt;/pdf&gt;';
          nlapiLogExecution('DEBUG','filename',template);
  
          var renderer = nlapiCreateTemplateRenderer(); 
          renderer.setTemplate(template); 
          //renderer.addRecord('url',url);
          var xml = renderer.renderToString();
          nlapiLogExecution('DEBUG','xml',xml);
          var combinefile = nlapiXMLToPDF(xml);
  
  
  
          combinefile.setEncoding('UTF-8');
          combinefile.setName('expense_f.pdf');
          nlapiLogExecution('DEBUG','file',combinefile);
          combinefile.setFolder(2221); // Amit_Expenses
  
          nlapiSubmitFile(combinefile);
  
      }catch(error){
          //nlapiLogExecution('DEBUG','error1',error.getDetails());
          nlapiLogExecution('DEBUG','error',error.toString());
      }    
  }
  </code></pre>
  
  <p>What this code is doing that it takes all 'jpeg' files related to an expense and create template containing all the files and generate a .pdf file containing all the images. Code is working perfectly fine.</p>
  
  <p>For now I have put the file url hardcoded for testing purpose.</p>
  
  <p>The problem is that code is not able to refer images for certain folders.
  Like if I am refer employees profile images it refers them but for some folders code is not able to refer images of those folders.</p>
  
  <p>I have checked that these folders are not private. Please Suggest</p>