The CreatorCon Call for Content is officially open! Get started here.

Generate Document and Attached it to record producer then to case

lomouhamadou
Kilo Guru

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

1 ACCEPTED SOLUTION

lomouhamadou
Kilo Guru

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


View solution in original post

5 REPLIES 5

Hi Lomouhamadou,

I have similar requirement. 

I have to create a button on record producer and when click on that button a pdf file to be generated. Please help me on this as you have already achieved this.