How correspondence works
Flow processing requires two main pieces of information to generate correspondence: who to send it to and what to send. There are two ways for your applications to provide this information: by prompting a human user to specify values, or by providing the values programmatically at the appropriate place in the flow.
Process Commander’s correspondence feature is supported by the following:
- Work parties. A work party is a person or organization associated with a work object. Correspondence can be sent only to people who are identified as work parties.
- Correspondence rules. These rules provide the content and logic that flow processing uses to generate customized correspondence for the recipient.
- Correspondence flow actions. When the (human) operator working on an assignment needs to specify information about what to send and who to send to, use correspondence flow actions.
- Correspondence activities. If the same piece of correspondence is to be sent to the same work party for every work object created by a flow, there’s no reason to make operators do any work. In this case, use flow shapes and standard activities to configure correspondence to be added programmatically.
- Background correspondence processing. Process Commander’s flow processing and agent activities take care of correspondence generation and processing in the background.
- Work parties
- Correspondence fragment and correspondence rules
- Correspondence type
- Prompting for input with HTML stream rules
- Flow shapes and correspondence activities
- SendCorrespondence flow action
- Editing or previewing generated correspondence
- Verifying generated correspondence
- Work object attachments and correspondence
- Background correspondence processing
- Summary of steps
During the design phase of your application development, you determined the work party roles of the people who will participate in or will be interested in the work objects that are created by your flows. Work parties can represent an organization or other entity, but typically they represent people. The operator who creates a work object always represents the Originator work party.
Standard flow actions enable operators to add work parties and their contact information – name, address, and so on – to work objects. Correspondence can then be sent to any person who is identified as a work party for the work object.
Work parties are supported by the following:
- Five Data-Party- classes that contain properties for holding contact information.
- Data-Party-Operator represents Process Commander users who have operator IDs.
- Data-Party-Person represents individual people who are not Process Commander operators, people such as customers or applicants or policy holders.
- Data-Party-Com represents for-profit companies and corporations such as vendors
- Data-Party-Gov represents government agencies
- Data-Party-Org represents not-for-profit organizations
- Work parties rules that list the work party roles associated with a specific work class. These rules contain a role name and map that name to an appropriate Data-Party- class. When operators add work parties to a work object, they can add people for only those roles that have been associated with the work class through a work parties rule.
By default, there are two standard work parties rules in Process Commander. Here's Work-.Default.
Therefore, even if you do not create a work parties rule for your work classes, your work classes inherit the roles listed in Work-.Default and Work-Cover-.Default.
Correspondence is constructed from correspondence fragment rules and correspondence rules. You use these rule types to construct templates for generated correspondence. At runtime — that is, during flow processing - Process Commander uses the text and code in the specified correspondence rule (template) to generate a customized message for the recipient.
Correspondence rules serve as the main template for the generated correspondence. For simple assignment notification messages, you might put text directly in a correspondence rule. However, for correspondence sent to external people such as customers or policy holders, you are more likely to store reusable pieces of content or code in fragment rules. You then use correspondence rules as containers that organize the component pieces in the appropriate order with JSP tags.
For example, headers that contain address blocks and the salutation, signature blocks, disclaimer statements, footers, and copyright statements are all examples of content that you are likely to use in more than one piece of correspondence. Whether you should use a fragment or a correspondence rule to hold that kind of content depends on your design needs.
Fragment Rules (Rule-Corr-Fragment)
Correspondence fragment rules are meant to hold reusable snippets of JSP code, text, and HTML formatting for the text. Following is the Stream tab of a correspondence fragment from the Sales Process Manager solution framework.
Like HTML fragments, correspondence fragments do not have an Applies to class, which means you can include any correspondence fragment in any correspondence or other fragment rule without specifying a page context for them. Unlike HTML fragments, correspondence fragments have a type. See Correspondence type for more information.
Correspondence Rules (Rule-Obj-Corr)
Correspondence rules are the container rules that include and order the appropriate fragments and correspondence rules needed for the end result (the generated piece of correspondence). Here's a correspondence rule from the Sales Process Manager solution framework that uses the pega:include JSP tag to reference three fragment rules:
For information about the pega JSP tags, see the Common JSP tags for correspondence section in "Correspondence Reference"
Correspondence rules are usually thought of as the top-level rule (or the container template) with fragments as the component parts of the template. However, you can treat correspondence rules like correspondence fragments when you need to organize correspondence pieces by work class. For example, say that you need to create several signature blocks that have the same name and type but need to vary for each work class. In this case, create correspondence rules for each work class to store the signature blocks.
Additionally, for very simple correspondence needs, you can create correspondence rules that contain the entire message without references to additional components. Here's an example:
One of the keys to correspondence and correspondence fragment rules is a correspondence type that represents the medium by which the resulting correspondence is sent. There are four standard correspondence types:
Correspondence type works in conjunction with work parties. When users add a work party to a work object, they provide the work party's contact information. When the correspondence flow actions are used to specify correspondence information, flow processing prompts the user first for the party role of the recipient of the correspondence. Then, based on the contact information available for that work party, flow processing filters the list of correspondence rules by the appropriate types. If the contact does not have an email address, email correspondence rules do not appear in the list.
Note what this means when you configure a flow that generates correspondence programmatically: you must ensure that the correspondence type of the rule you specify must be appropriate for the party role you specify. If you specify an email correspondence rule, parties with the role you specify must have email addresses.
Most organizations find the standard correspondence types to be sufficient for their application designs and it is rare to add new correspondence types. However, if you need to add a new correspondence type, see the Application Developer Help for instructions.
If a piece of correspondence will be selected by a human user (rather than generated in the background), you can configure the correspondence rule to prompt operators for input. The flow actions SendCorrespondence and Notify prompt the user to select a work party and a correspondence rule. If there is additional information that cannot be provided programmatically through property references, configure the correspondence template to provide a prompt for it.
First you must write an HTML rule to display the input field. Then you specify the HTML stream rule on the Prompt tab of the correspondence rule. (For more information about this process, see How to create correspondence rules that prompt users for input
The applies to class of an HTML stream rule that you want to use with a correspondence rule must be one of the following, based on the correspondence type of the correspondence rule:
- Data-Corr-Letter (type = Mail)
When the same piece of correspondence should go to the same work party for every work object created by a flow, you configure the flow to provide the correspondence programmatically. Which flow shape to use depends on if it is a notify message for an assignment.
- To send automatic notification messages about assignments, use the notify shape with one of the standard notify activities (Work-.Notify, for example).
- To send any other kind of correspondence programmatically, use the utility shape with the Work-.CorrNew activity.
For information about these activities, see Correspondence reference.
When an operator must specify the work party role and correspondence rule for each individual work object, must edit the generated correspondence, or is required to enter additional input, use the main, all-purpose flow action SendCorrespondence.
SendCorrespondence starts a screen flow named BuildCorr. BuildCorr is a screen flow that walks the operator step-by-step through the process of specifying the work party role, selecting a correspondence rule, entering values for any fields the correspondence rule needs input for, and so on. If the work object has attachments, the operator can select which attachments to use as email attachments.
If your application design is such that operators do not need to designate work object attachments as email attachments or send the correspondence to more than one person, the Work-.Notify flow action is also an option. The Notify flow action behaves similarly to the SendCorrespondence flow action. However, rather than launch a subflow that prompts operators to build correspondence, it displays the appropriate fields in the form rendered by the harness that represents the assignment. However, when operators use the Notify flow action, they cannot specify email attachments and they cannot specify more than one recipient.
When you create correspondence rules that operators will select, use the User Edit field at the bottom of the Corr tab to specify whether they are allowed to edit or preview the generated messages:
You can configure the rule to allow the operator to preview but not edit, to edit if necessary, and so on. When the User Edit field is set to anything other than No Edit, the SendCorrespondence and Notify flow actions display the generated results to the operator at runtime.
Important: If the correspondence rule is used to create correspondence programmatically (that is, without user intervention), never select the Must Edit option. If you do, the rule will cause an error during flow processing.
In many organizations, customer documents contain sensitive data or offers that need to be reviewed by a supervisor or underwriter before it can be sent. When you create correspondence rules, use the After Create field at the bottom of the Corr tab to specify that any correspondence generated from the rule must be verified:.
When correspondence is generated a rule with its After Create field set to Verify, flow processing starts a flow named Work-.VerifySendCorr.
The VerifySendCorr flow creates an assignment and routes the generated correspondence to the work group manager of the operator who caused the correspondence to be generated. When managers complete their verification assignments, they can edit the generated correspondence if necessary. Then they either verify (approve) or reject the assignment.
Several standard flow actions prompt operators to attach files of some kind to the work objects they are assigned. For example, the AddAttachments flow action enables users to upload a single file and select a category for it while AddMultipleAttachments enables user to select multiple files and choose a category for each.
Correspondence processing can use work object attachments as email attachments. For example, the CorrNew activity has an input parameter for attachment category. At runtime, if the category parameter has a value and a file has been attached and identified by that category, correspondence processing attaches the file to the email message.
Additionally, when an operator interacts with the SendCorrespondence flow action, if there are any work object attachments, the form displays them and the operator can select which ones should be email attachments. Here's an example of one of the BuildCorr screen flow forms when a work object has an attachment.
The standard activities and flow actions that you use to add correspondence generation to your flows are used by the flow and correspondence processing that generates email messages or Word documents or PDF forms in the background. All you have to do is reference the CorrNew activity or correspondence flow actions in the appropriate places in your flows and Process Commander takes it from there.
Correspondence processing queues up the messages or documents to be emailed, printed, or faxed in the Assign-Worklist queue. The Pega-ProCom agent activity named SendCorr runs every 30 seconds and processes all the correspondence in the Assign-Worklist queue.
The following list summarizes the general steps for configuring correspondence generation in your flows.
- Create the work parties rules that associate work party roles with your work classes.
- Configure an email account object (Data-EmailAccount) that holds information about the email server and user account flow processing should use to send outbound email.
- Create correspondence, correspondence fragment, and HTML stream rules.
- Configure your flows to call the standard correspondence activities and flow actions at the appropriate places.