- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2016 06:18 AM
Hi all,
I have a UI page that uses the HR_PDF_template to generate a pdf document from record producer form.
the pdf is generated with values and fields I want but it is not attached to the record producer form.
Can you Help on that, please?
UI Page Jelly/html part
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:requires name="html2pdf.jsdbx" />
<div id='printable'>
</div>
<button type="button" onClick='downloadPDF()'>
${gs.getMessage('Generate PDF')}
</button>
</j:jelly>
On the cleint script part I managed fields that needs to be part of the pdf and have following fucntion and they work fine
//Printing on the Screen |
document.getElementById("printable").innerHTML = this.body;
//Downloading the file
html2pdf(jQuery('#printable'),'letter','Sample.pdf',['a','button']);
}
function setParamenter(parameter,value){
this.body = body.replace('{'+parameter+'}', value);
}
Now, What should I do to get the generated document attached to the record producer?
Add something in the jelly part or a function to the client script part.
Thanks in advance for your answer,
Regs,
Lô Mouhamadou
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 07:03 AM
Finally, I made the variables visible on the hr_case form and make them read-only.
This way, pressing the button generate the pdf and it is not stored what mean no waste of story usage

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2016 06:56 AM
If you're not going to make use of the browser's print to pdf functionality it can be pretty difficult to do, but I think there may be a couple of share apps that can help with that.
That being said, I would take a step back and make sure that you really need to generate a pdf and attach it. If you already have all of the information from the ui page, why not just copy that info into the request without generating a pdf? PDFs are usually only necessary if you're needing to print or download something or if you have something that has been signed you need to attach.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-23-2016 07:46 AM
Hi Brad,
thanks for your answer.
Yes, we need the PDF.
Based on information provided by end user on the record producer's form, a pdf is generated.
Then user has to print it, sign it and then attached again to the case created from the record producer.
I want to save the pdf when it is generated in case user lost the generated doc. In that case he has to go to the case and download it again.
If it is not saved he has to request again.
I am also using the print function to displays the content of thge pdf
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2016 02:36 AM
Hi Brad,
Do you have any idea on how to save the file in servicenow.
I mean how to attch it to the record producer after it's generated
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-05-2016 07:03 AM
Finally, I made the variables visible on the hr_case form and make them read-only.
This way, pressing the button generate the pdf and it is not stored what mean no waste of story usage