Hi syed


thanks its work fine as you suggested thank you



here is my code




var attachLink='';


  var ga = new GlideRecord('sys_attachment');


  ga.addQuery('table_sys_id',this.tableId);


  ga.query();


  if (ga.hasNext()) {



  while (ga.next()) {


  attachLink = attachLink+ ga.file_name ;


  }


  }



  parsedBody = parsedBody.replace(/\$\{date\}/gi, date);


  parsedBody = parsedBody.replace(/\$\{letterid\}/gi, this.letterid);


  parsedBody = parsedBody.replace(/\$\{Attachments\}/gi,attachLink);


Ronnie Galvez
ServiceNow Employee

Thanks Syed for this.   One customer reported an issue about the display of their multi-line string not recognizing the new line.   So we added this regex to replace all carriage return + new line with <BR>.



find_real_file.png


Ronald Garfield
Kilo Explorer

Is it possible to create Landscape PDF's.


I send a landscape variable to the GeneralPDF script include but it has no effect?



var pdfDoc = new GeneralPDF.Document(this.landscape, null, null, null, this.pageSize, this.headerImage);



I've tried : this.landscape = true and this.landscape = "Landscape"


The "version" i use is a mix of ServiceNow plugin and parts of Walter Brame's version, so this might not be the ideal way.



But in GeneralPDF - under addHtml i added.


if(element.toString() == "[{!Rotate}]"){


this.document.setPageSize(PageSize.A4.rotate());


this.document.newPage();


}



You could skip the if statement, if it's every page



And then add the following in GeneralForm (if needed)


parsedBody += '{!Rotate}';


toshit
Kilo Contributor

Hi Syed,



I followed all the steps but I am getting error 'Illegal attempt to access class 'com.itextpdf' via script'


I read in another post that it is due to restricted security access to Java class and it can be overridden by setting property glide.whitelist.manager.collection_mode.override=true


but I am getting below error on setting this property: Not allowing set of unsafe property value: glide.whitelist.manager.collection_mode.override=true


Any help is highly appreciated !!