HTML and PDF printouts in BPS – examples


applies to version: 8.1.x; author: Marcin Wiktor

The goal of this article is to demonstrate examples of BPS functionality – PDF and HTML printouts.

HTML printout action may be set for the following types:

–          On exit

–          On path

–          Menu button

–          Menu button (global)

PDF printout action may be set for the following types:

–          On entry

–          On exit

–          On path

–          Menu button

–          Menu button (global)

Such difference comes from the fact that PDF may be saved as an attachment to currently processed document. Description of such configuration may be found in example 2.

1. Example of functionality – Vacation request

For the needs of this article exemplary vacation request workflow with following form fields will be used:

–          Start date (date and time)

–          End date (Date and time)

–          Registration date (date and time)

–          Number of days (integer number)

–          Registering person (person or group)

–          Superior (person or group)

–          Vacation type (choice field)

–          Description (multiple lines of text)

Vacation request graphic scheme

In given example we will use possibility to generate HTML printout and PDF printout (for displaying) as and global action – menu button. Button will be available in every step except Registration step.

First, open new document in browser and turn Admin mode on.

Admin button

Then, among new options choose HTML template button and save new file.

HTML Template button

Downloaded template contains list of all possible tags (which we may use for given workflow) for HTML printout.

List of tags available in Vacation process

List of all available printout tags is available in BPS Studio help (F1 button) in Tags topic. Advanced tags, which are not shown in generated template may also be found there.

It is easy to see, that tags are just names of columns from database. In case of fields with ID and name, for eg. {CURRENTUSER}, {DTYPE_name} or choice fields defined as pickers, name of such column itself will return both: ID and name (values separated by # sign).

If we want to get only ID, then it is necessary to place “I:” in front of field name.

In case in which only name is needed, field name should be proceeded by “N:

As an example we may use “Superior” form field. Tag {WFD_AttPeople2} itself will return login and name of superior. For our purposes, we will need only name and surname of our superior, without login. Here, column name should be preceded by N: – {N:WFD_AttPeople2}. Now only name and surname will be displayed on report.

In our printout we want to use basic information about document and values of all form fields in proper form.

Printout template itself may be HTML or ASPX file. In our examples we will use only HTML files. In case of this process we will use simple template:

HTML code of Vacation process printout template

Save template as template_vacation_request.html

Saved template should be placed in any SharePoint library. Our template will be saved in “Vacation” site in “Site assets” library, which is created for every site by default.

Site assets library

Both printouts will be placed as global actions – menu button.

Enter vacation process, choose tab “Global actions” and add two actions – “Generate HTML” and “PDF printout”.

Configuration of HTML printout is restricted to entering address of previously generated HTML template:

Generate HTML action configuration

In configuration of action which generates PDF also template address must be given but additionaly in “Generate to” section, check “Display on screen” and in “Footer options”, uncheck “Show footer”.

PDF printout action configuration

In the end, after choosing one of actions of “Menu button” type, next to Settings tab, new tab, Menu button, will show up.

Menu button tab


Here we may configure for eg. Confirmation of action execution, visibility restriction or action icon. As both buttons cannot be visible on registration step, proper condition must be added.

Menu button configuration


Now check if both actions are configured properly:

Effects of correct configuration of printout actions as “Menu button”

In the end, let us see effect of one action – Generate HTML

HTML printout for leave applicationExample two – PROCES ZAPOTRZEBOWANIA

2. Example two – Purchase Order

In following example we will use simple process of registering purchase order

We will use 3 form fields:

–          Registration date (date and time)

–          Registering person (person or group)

–          Comments (multiple lines of text)

And items list consisting of following columns:

–          Title (single line of text)

–          Category (choice field)

–          Cost (floating-point number, configured as an amount with currency code)

–          Description (multiple lines of text)

Graphic scheme of purchase order workflow

After accepting request, PDF printout will be generated on path and then added to a document as an attachment.

First, generating HTML template (just as in first example) and then preparing our HTML template is necessary. For this process we will use template shown below:

HTML code of prinout template for Purchase order process

Save template as template_purchase.html and analogically as in previous example, place it in library “Site assets”.

First part of printout is similar to the one from previous example so it will not be discussed here. We will describe part corresponding to items list printout.

It consists of 3 parts:

–          Header – {SUBELEMHEADERTEMPLATE:40}

–          Part displaying all verses from the table – {SUBELEMROWTEMPLATE:40}

–          Footer – {SUBELEMFOOTERTEMPLATE:40}

Number 40 in tags above is unique ID of items list.

For correct display of items list content, only middle part is necessary – {SUBELEMROWTEMPLATE:40}. Header and footer is optional although it is good practice to use header as it will be easier to read such list.

In our example, footer will be used to calculate sum from “Cost” fields.

It is recommended to place whole list as HTML table, but it is not required.

Tag names – similar to the ones displaying values of standard fields – they come from names of columns, which store their values in database.

According to process assumptions, we want our printout to be attached to every accepted document as an attachment, so we have to configure proper action.

Create new action of “Generate PDF” type on entry to “Accepted requests” step.

Generate PDF action

Then go to configuration of action and fill Document template, SQL file name, description of SQL attachment and in top part of “Generate to…”, check “Add as an attachment”.

Generate PDF action configuration

When documents goes to “Accepted requisitions” step we may check if an attachment with correct printout was added:

Effects of correct Generate PDF action execution

And printout itself:

Generated PDF file as document attachment

Second specific field type for reports along with items list are SQL grids. They are created analogically to lists, with differences in tag names. These are respectively:




3 thoughts to “HTML and PDF printouts in BPS – examples”

  1. How to use multiple list to generate html email template

    I tried to make two html tables but second table is not showing any value

Leave a Reply

Your email address will not be published. Required fields are marked *