HR PDF document templates in non-scoped HR

HR document templates are used to generate PDF documents that include information from an employee's HR profile, in the non-scoped version of HR. You can generate PDF employment verification letters for existing employees. You configure PDF document templates with your company information and logo.

You can configure multiple PDF document templates, for example, if you have different letters for different countries. The following templates are predefined.
  • Employee Verification Letter in Canada
  • Employee Verification Letter in USA
Before you begin generating documents you need to configure the templates with your company logo and text. It is recommended that you obtain the following items and information to configure the predefined HR document templates, or to create new ones.
  • A page of your company's letterhead.
  • Copies of your current employment verification letter and offer letter templates, if available.
  • The logo image to use in your header. The header image can be a maximum of 50px high. If your letterhead includes a logo and text, ensure that the logo image includes the text, as you can only configure the image in the header.
  • The logo image to use in your footer, if applicable. The logo image can be a maximum of 15px high. You can configure both an image and text in the footer.

Modify an HR PDF document template in non-scoped HR

You can modify the predefined HR PDF document templates with your company logo and custom text.

Before you begin

Role required: admin, hr_manager, or hr_admin

Role required: admin, hr_manager, or hr_admin

About this task

Each pdf document template contains configurable areas for the header, body, and footer. You can enter the body of the letter in a WYSIWYG text editor, and place variables to retrieve information from the employee's or candidate's HR profile.

Procedure

  1. Navigate to HR • Administration > Catalog & Templates > PDF Document Templates.
  2. To add a header image, such as your logo, complete the following steps.
    1. Next to Header image, select Click to add.
    2. Click Choose File and select the header logo image from your computer, then click OK.
    3. From the Image position choice list, select the position of the logo.
  3. To edit the body, perform the following steps.
    1. Review the text and update it with the text from your current document template.
    2. Add any additional variables as needed. The following list contains all variables that you can add.
      {{Date}} {{Work email}} {{Department}}
      {{Name}} {{Work phone}} {{Employee number}}
      {{Position}} {{Prefix}} {{Employment status}}
      {{Time type}} {{Nationality}} {{Employment type}}
      {{Employment start date}} {{Manager}} {{Gender}}
      {{New Employee}} {{New Employee Address}} {{Position Title}}
      {{New Employee Last Name}} {{Position Type}} {{Start Date}}
      {{Hiring Manager}} {{Yearly Compensation}} {{Overtime Pay Rate}}
      {{Bonus}} {{Number of RSUs}} {{HR Manager}}
      {{HR Manager Title}} {{Signature}} {{Start Date}}

      To modify the list of available variables, edit the generalhrform script include.

    3. (Optional) Use the formatting tools to perform any of the following actions.
      Format the text Select the text to format and apply any of the formatting options, such as bold, italic, underline, font styling. You can apply justification, bullets, and numbers as needed.
      Add an image Click the image icon and attach the image or search for it in the image library. You can also add a new image to the library.
  4. To configure the footer, perform the following steps.
    1. If you have a footer image, select Click to add next to Footer image.
    2. Click Choose File, select the footer logo image from your computer, then click OK.
    3. From the Image position list, select the position of the logo.
    4. Enter the footer text, if applicable.
      The footer text appears based on the selected footer image position. If you selected to position the image on the right or centered, the footer text is left-justified. If you selected to position the image on the left, the footer text is right-justified. If there is no footer image, the footer text is center-justified.
    5. Select the page size.
  5. Click Update.

What to do next

Review the look of the generated letter by impersonating an employee and submitting the associated catalog item. You must impersonate the user assigned to work on the case to generate the letter within the HR case. Continue editing and testing the letter template until you are satisfied with the generated PDF.

Add an HR PDF document template in non-scoped HR

You can add HR pdf document templates for employment verification or job offers as needed.

Before you begin

Role required: admin, hr_manager, or hr_admin

About this task

The easiest way to add a new HR PDF document template is to open one of the existing templates and save it as a new template. The steps below follow this process.

Procedure

  1. Navigate to HR • Administration > Catalog & Templates > PDF Document Templates.
  2. Open one of the HR PDF document templates of the type that you want to add.
  3. Enter a new name.
  4. Right-click the form header and select Insert and Stay.
    The new HR PDF document template is saved and the page refreshes with the new name.
  5. Perform any of the following actions to modify the template.
    For more information about updating the form sections, seeModify an HR PDF document template in non-scoped HR .
    OptionDescription
    Update the header logo Select a new image and position, as needed.
    Update the text Enter and format the text in the Body. Available variables are listed below.
    Update the footer Select a new footer image and its position, as needed. Modify the text if necessary.
    Change the page size Select the page size from the choice list.
    HR PDF document template variables:
    {{Date}} {{Work email}} {{Department}}
    {{Name}} {{Work phone}} {{Employee number}}
    {{Position}} {{Prefix}} {{Employment status}}
    {{Time type}} {{Nationality}} {{Employment type}}
    {{Employment start date}} {{Manager}} {{Gender}}
    {{New Employee}} {{New Employee Address}} {{Position Title}}
    {{New Employee Last Name}} {{Position Type}} {{Start Date}}
    {{Hiring Manager}} {{Yearly Compensation}} {{Overtime Pay Rate}}
    {{Bonus}} {{Number of RSUs}} {{HR Manager}}
    {{HR Manager Title}} {{Signature}} {{Start Date}}
  6. Click Update.

What to do next

Review the look of the generated letter by impersonating an employee and submitting the associated catalog item. You must impersonate the user assigned to work on the case to generate the letter within the HR case. Continue editing and testing the letter template until you are satisfied with the generated PDF.

PDF APIs and PDF document templates in non-scoped HR

Use PDF APIs to create PDF document templates.

PDF APIs are called through server-side scripts like business rules and script includes.

API Details

The GeneralFormAPI.setDocument() sets document parameters for PDF generation. The parameters are:

setDocument(

headerImage Image in the header of the document template.
, footerImage Image in the footer of the document template.
, footnote Footnote at bottom center.
, headerPosition Position of header image. Values are Left, Right, and Center.
, footerPosition Position of footer image. Values are Left, Right, and Center.
, pageSize Sets page size for document template. Values are Letter, Legal, and A4.
View the 'generate()' API function in the GeneralHRForm script include to see how the API works:
Code snippet:
var generalFormAPI = new global.GeneralFormAPI(this.fileName, this.targetTable, this.targetId);
generalFormAPI.setDocument(this.headerImage, this.footerImage, this.footnote, this.headerPosition, this.footerPosition, this.pageSize);
generalFormAPI.createPDF)this.body);

Document generation APIs and script includes in non-scoped HR

The following APIs and script includes are available for generating PDF documents.

The GeneralHRForm script include has the following APIs:
API Input Output Description
generate manual (Boolean) Generation status (Boolean) Generates a PDF document. When set to true, generates documents manually. For example, Generate action on Preview Document. This API returns a boolean value when a pdf is generated.
createPDF tableName (String), tableId (String) N/A The inactivateRelatedDrafts inactivates draft documents for the tableName and tableId input parameters. When the tableId is the sys_id of a case with child tasks, then draft_documents for the tasks are also inactivated.
hasDraftDocument tableName (String), tableId (String) Boolean Returns a boolean value when a draft document is attached. Input parameters are tableName (takes name of the table the draft document is attached), tableId (takes the sys_id of the table). The table can be the HR Task or HR Case when the sys_class_name within the api call.
getDraftDocument tableName (String), tableId (String) draft document Glide Record (GlideRecord) Takes tableName and tableId of the record that the draft document is attached to. It returns the draft document GlideRecord matching queried based on input values.
remove_all_variables parsedBody (String) parsedBody (String) The remove_all_variables method takes document body and removes tags (${dummy_tag_value}).
validateTemplate parsedBody (String), tableName (String) parsedBody (String) Validates tags in a document template body. The variables in the tags are matched against the fields/dot-walked fields of the tableName passed as an input argument.
The GeneralFormAPI script include has the following APIs:
API Input Output Description
setDocument headerImage (String), footerImage (String), footnote (String), headerPosition (String), footerPosition (String), pageSize (String) N/A Sets the building blocks/parameters of a document for PDF generation.
createPDF body (String), pages (number) N/A Takes body and number of pages and generates the PDF document. After the document is generated, it is attached to the table that the createPDF action is requested.
setDocTempleInfo headerImage (String), footerImage (String), footnote (String), headerPosition (String), footerPosition (String), pageSize (String) N/A A setter method for setting document template building blocks.
startHTMLParser N/A N/A Opens a write stream for htmlparser to enable document generation.
The GeneralPDF script include has the following APIs:
API Input Output Description
setDocument headerImage (String), footerImage (String), footnote (String), headerPosition (String), footerPosition (String), pageSize (String) N/A Sets document template building blocks.
startHTMLParser N/A N/A Opens a write stream for htmlparser to enable document generation.
stopHTMLParser N/A N/A Closes the write stream after document generation method is complete.
addHTML html (String) N/A Appends html snnipets to the document body.
addNewPage N/A N/A Moves the cursor to the next page.
addCells cells (Object), row_length (String) N/A Adds cells, relevant text, and properties to a table.
addSVG svg (String), position (Object) N/A Adds svg to a document template.
setPDFDoc pdfDoc (Object) N/A Sets pdfDoc objects.
setProperties properties (Object) N/A Sets document properties.
setHeader header (String) N/A Sets the header for a document template.
Note: Not used.
setFooter footer (String) N/A Sets the footer for a document template.
Note: Not used.
setWatermark watermark (String) N/A Sets watermarks on a generated PDF document.
get N/A ByteArrayInputStream Returns a document as a ByteArrayInputStream.