- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 09:00 AM
Hi Syed ,
i am trying to call this script within pdf template is it possible??
<mail_script>
attachLinks();
function attachLinks() {
//Check for any attachments and add attachment links if they exist
var gr = new GlideRecord('sys_attachment');
gr.addQuery('table_sys_id',current.sys_id);
gr.query();
if(gr.hasNext()){
template.print('Attachments: \n');
while (gr.next()) {
var attachLink = '<a href="' + gs.getProperty("glide.servlet.uri") + gs.generateURL(gr.getTableName(),gr.sys_id) + '">' + gr.file_name + '</a>';
template.print(attachLink + '\n');
}
template.print('<hr/>');
}
}
</mail_script>
my requirement is pdf document will show the document list attached with that particular incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-12-2016 04:22 PM
I dont think you can use <mail_script> in document template.
However you can look into developing some script in script include which could return the list. Have a look at below code in parseBody method.
| parsedBody = parsedBody.replace(/\$\{date\}/gi, date); | ||
parsedBody = parsedBody.replace(/\$\{letterid\}/gi, this.letterid); |
you could build a variable similar to this i.e ${attachlinks} and script in parseBody to return the values you want.
Cheers
Syed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-13-2016 12:25 PM
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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2016 05:44 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-15-2016 05:11 AM
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"