How to configure email-based work processing
This article describes how to configure a PRPC application to automatically create and resolve work items using email. This approach depends on standard rules and capabilities introduced with PRPC 6.2 SP2.
In this simple example, a manager sends an email request to order required hardware. The email is received and validated and a work item is created automatically. Work is performed on the work item, and an email for manager approval is automatically created and sent. The manager receives the email, and replies by clicking the appropriate link to approve or reject. Upon receipt, the email is validated, and the work item is automatically processed and resolved.
This capability is limited to creating simple work items (with few properties) from an incoming email. As work items are resolved, the response is limited to selecting one flow action from a fixed list in the email. This diagram explains the process flow.
Part I: Create required email rules.
- Use the Email Wizard, sometimes called the Email Accelerator, to create email rules for creating and managing a work object. Select > Integration > Email > Email Wizard. See Developer Help for more information.
- Complete the Email Information form. Check the box beside Would you like to create work? Click Next.
- Complete the Email Listener form. In this example, the Listener is configured to monitor the Email Account called Grahl. Click Next.
- Complete the form to configure a Service Package. Click Next.
- Complete the Email Account form. Set a password, as that field may not be left blank. Click Next.
- The email configuration is complete. You can view the list of rules created. Click Done.
Part II: Validate email setup files and complete configuration.
- Locate the Email Account rule instance using Rules Explorer > Integration-Resources > Email Account. The rule appears as:
- Click Test Connectivityfor Sender and Receiver.
- Use the PRPC System Management application to validate that the new listener is running.
- The Email Wizard creates the Service Email rule and specifies the standard service activity pyCreateAndManageWorkFromEmail and parameters. If you are using an existing email service rule, add this activity and appropriate parameters, as shown below.
The Request and Response tabs are also populated when you use the Email Wizard to create the Service Email rule. (If you did not use the Wizard, complete these fields.)
On the Response tab, the when rules determine the contents of the response message, and whether a message is sent.
- In the Agent Schedule's Schedule tab, enable the ProcessEmailRequest activity.
On the Security tab, include the access group of the work class that contains the flow to be processed.
Part III: Configure the flow rule.
- EquipmentRequest is the starting flow name referenced in the first screen of the Email Wizard. This very simplistic flow rule demonstrates how to create a work item from an email received by firstname.lastname@example.org,the Receiver account you specified in the Email Account configuration.
When the flow action is completed, an email with embedded Approve and Reject flow actions is automatically generated and sent to the manager from the Sender account you specified. This is accomplished through configuration on the Notifications tab on the ManagerReview assignment.
The manager replies by clicking one of the flow action links in the email. The reply is received by email@example.com, the email is validated, and the work item is automatically processed according to the flow action.
- Configure the Hardware Needed assignment. You may choose to set up routing for the incoming work item.
- Configure the ManagerReview assignment. The parameters on the Notification tab, Subject and CorrName, are required, and contain the following entries that enable an email to be sent for approval, returned, and automatically processed.
You can customize the correspondence rule pzEmailActions , and save it to your work class. Do not remove the include tag <<include pxEmailActions>> in the correspondence rule. The tag causes the flow actions to appear in the outgoing email.
Part IV: Test your configuration using a sample email.
- To test, send an email to the address specified in the Email Listener rule. See firstname.lastname@example.org this example.
- When the listener detects the new email in the email@example.com account, the standard service activity pyCreateAndManageWorkFromEmail validates the email. If the validation is successful, a work item is created automatically, and a return email that provides the new work item number (ER-168 in this example) is sent. If validation errors are detected, a failure email is sent to the requestor.
- In the portal, you can verify that work item ER-168 is created. The subject line of the email populates the work item description.
- The operator assigned to the work item clicks the flow action Select Hardware , makes a selection, then clicks Submit, advancing the work item to the next step in the flow, ManagerReview . An email is generated, sent out, and also attached to the work item.
- Click the attachment to view the email contents.
- The email is received by the firstname.lastname@example.org account in this example and contains the two flow action links you defined in your flow. The flow actions appear as a result of the <<include pzEmailActions>> in your correspondence rule.
- The manager clicks the appropriate action, approve or reject, and can enter text, if desired. The Subject line is populated using parameters you supplied on the Notification tab of the assignment. The reply is sent to email@example.com (in this example).
Some email clients may not properly handle the mailto parameters.
- The service activity pyCreateAndManageWorkFromEmail validates the incoming mail. The email is attached to the work item, which is then resolved (either approved or rejected as indicated), and the item status changes accordingly.
- Click Audit to view the history of the work item. As indicated below, the pyProcessEmail Request email agent handled the processing automatically.