Skip to main content

         This documentation site is for previous versions. Visit our new documentation site for current releases.      

This content has been archived and is no longer being updated.

Links may not function; however, this content may be relevant to outdated versions of the product.

How to produce PDF reports on a nightly schedule

Updated on September 20, 2019


Using an agent, standard activities, and a Connect File rule, your application can create, once each night, a snapshot Portable Document Format (PDF) file containing list view report output.

The approach can be generalized to produce a set of daily, weekly, or monthly reports.


Suggested Approach

In addition to the list view report, you need to construct three rules:

  • An activity that runs a list view rule and captures the report output as a PDF document in a parameter. The PDF document is not sent to a user browser session.
  • A Connect File rule that writes the PDF document to the file system as a PDF file.
  • An Agent rule that causes the activity to run once each night.

Note: This approach works for list view reports, not for summary view reports or for charts. Interactive charts contain Adobe Flash output, which is not supported by Adobe's PDF file format.

Step 1: Identify the list view rule

You may execute any list view report that does not require users to supply prompt values for report selection criteria. Note the RuleSet and version for the list view rule. If the selection criteria involve dates, consider using symbolic dates.

In this example, the list view report MyCo-Emerald-Task.ShowYesterday.ALL reports on work objects that were created yesterday but remain open.


This report shows a few basic facts about each selected open work object:

Display Fields tab

Step 2: Build the Connect File rule

A Connect File rule identifies the directory on the Process Commander server that is to contain the output file, and the name of the output file. Set the Applies To key part of the Connect File rule to Code-Pega-eForm.

In this example, the output file name uses the Global Resource Setting syntax =pagename.propertyname, so that the output file name can vary from execution to execution. (As shown below, the property pyLabel on page PDFPage contains the run date.)

Save. You can click the Test Connectivity button to confirm that the destination directory — D:/temp in this example — exists.

Connect File rule

Step 3: Build the activity

Create an activity. In this example, the Applies To key part of the activity is the same as the Applies To key part of the list view rule.

On the Security tab, check the May Start? box and clear the Authenticate? box. Set the Activity Type to Activity.

Activity Security tab

On the Pages & Classes tab, enter a page name (such as PDFPage) of class Code-Pega-eForm.

Activity PNC

Complete the Steps tab. In activity step 1, set the value of five parameters for the standard activity Rule-Obj-Report-.getReadOnlyReportDisplay. The correct spelling of the fourth parameter is ViewOwner (not VewOwner, which appears on the Parameter tab of that activity).

Step 1

In activity step 2, call the standard activity Rule-Obj-Report-.getReadOnlyReportDisplay. This activity executes the report and saves the resulting HTML code into an output parameter named pyViewData.

In activity step 3, use a Property-Set method to copy the parameter pyViewData into parameter Markup.

Steps 2 and 3

In activity step 4, call the standard activity @baseclass.HTMLtoPDF. This activity accepts as input the HTML code in param.Markup and returns a the PDF document in a Java byte array parameter named PDFDocument.

In activity step 5, create an empty page of class Code-Pega-EForm.

Activity step 4 and 5

In activity step 6, copy the Java byte array in param.PDFDocument into a Java Object property pyEForm, on the new page.

In this example, the output file name in property .pyLabel is formed by concatenating the current date, the list view middle key part, and the file type suffix ".PDF". For example, on April 14, 2009 the report file is named 20090414OpenYesterday.PDF and contains data about work objects created on April 13.

Activity Step 6

In the final step 7, the activity calls the Connect-File method to write out the file.

Step 7

Save the Activity form. At this point, you can test the activity.

Step 4: Build the agent

Create an agents rule named for the RuleSet.

  • On the Schedule tab, reference the activity and enter a recurring schedule, such as one minute after midnight.
  • On the Recurrence window, type the time zone carefully, using one of the time zone codes available from the Advanced tab of the Operator ID form.
  • On the Security tab, choose an access group that ensures the agent has the ability to find and execute all the rules mentioned in the article.


Step 5: Enable and test

On the Agents form, enable the activity and the Agency-Wide settings. Save the Agents form. After approximately 10 minutes, your system will contain one agent schedule instance, derived from the agent rule, with a node hash as key part . In a multinode clustered system, open and disable the agent on all but one node.

Use the System Management Application to verify that the agent executes as scheduled. Note that the Recurrence setting defines a "not-before" time of 12:01 AM. The activity may run at 12:01:00, or 12:03:59, or even later if the node is is busy around midnight. The agent activity doesnot run at exactly the same time each morning. However, it only runs once.


Click the PDF file to review report output.

PDF file'

Further steps

These possible enhancements can make the capability more robust and general-purpose:

  • The activity can be adjusted to run any list view report in the Applies To class, based on a parameter.
  • The activity does not check the status value @baseclass.pyStatusValue for the success value "Good" from the Connect File execution. As a good practice, this examine this value and write a log message when the value is not "Good".
  • The activity can be enhanced to run multiple reports (in sequence, one at a time) and create multiple output files.
  • Using the Connect-FTP method, you can copy the output PDF files files from the Process Commander server to a remote server.


Related Topics


Pega Platform 7.1.1 - 7.4 Reporting Financial Services Healthcare and Life Sciences Insurance Communications and Media Government Healthcare and Life Sciences Consumer Services Consumer Services Manufacturing Consumer Services

Have a question? Get answers now.

Visit the Support Center to ask questions, engage in discussions, share ideas, and help others.

Did you find this content helpful?

Want to help us improve this content?

We'd prefer it if you saw us at our best. is not optimized for Internet Explorer. For the optimal experience, please use:

Close Deprecation Notice
Contact us