- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 11:54 AM
Hi all,
I'm trying to generate an HR document template from a UI action using the instructions on the documentation site. The documentation states that a UI action can be used to generate the PDF. However, I can't find any real examples of where this is being used so I don't know exactly how to format the code in the UI action (or what other steps may be involved to make this work, other than creating the template itself). The Generate a PDF from a document template (HTML) page gives some code examples but I can't seem to make it work.
Can someone please provide an example and any additional details on how I can get this to work?
Thanks,
Justin
EDIT: To give some more context, I'm trying to generate the PDF on an HR task using data from the parent HR case.
Solved! Go to Solution.
- Labels:
-
Case and Knowledge Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 01:56 PM
Hi Michael,
Thank you for your response. I ended up making it that far but was still seeing an error for "PDF template cannot be found". I did some debugging and found that I wasn't sending over the right parameters to pull in the PDF template. After fixing the code, it works now.
Here is what I ended up using in the UI action:
var tableName = current.parent.sys_class_name;
var tableId = current.parent.sys_id;
var targetTableName = current.getTableName();
var targetTableId = current.getUniqueValue();
var hrForm = new GeneralHRForm(tableName, tableId, targetTableName, targetTableId).generate();
So a combination of the code above and ensuring the PDF template was on the case resolved the issue.
Appreciate your help!
Justin

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 12:59 PM
Hi Justin,
You can call to that template from the HR Case template (there is a PDF Template field you can add to the HR Case Template). You can have the OOB generate the document automatically using the case option on the HR Service Config, or you can manually generate it from the button on the case (once it is in Work In Progress).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-12-2020 01:56 PM
Hi Michael,
Thank you for your response. I ended up making it that far but was still seeing an error for "PDF template cannot be found". I did some debugging and found that I wasn't sending over the right parameters to pull in the PDF template. After fixing the code, it works now.
Here is what I ended up using in the UI action:
var tableName = current.parent.sys_class_name;
var tableId = current.parent.sys_id;
var targetTableName = current.getTableName();
var targetTableId = current.getUniqueValue();
var hrForm = new GeneralHRForm(tableName, tableId, targetTableName, targetTableId).generate();
So a combination of the code above and ensuring the PDF template was on the case resolved the issue.
Appreciate your help!
Justin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
11-29-2020 08:34 PM
Hi Justin,
We are having similar requirement to generate PDF from HTML template.
Would you please share how the code above works?
Thank you.
Godfrey