Defining Structured Email Handling

This chapter provides an overview of structured email and discusses how to:

Click to jump to top of pageClick to jump to parent topicUnderstanding Structured Email

This overview discusses:

Click to jump to top of pageClick to jump to parent topicWebforms and Structured Email

Structured email is generated from a Web page where customers enter and submit information. The Web page takes the information that customers enter, applies XML markup, inserts a Webform ID, and sends the XML as an email to a mailbox that the PeopleSoft CRM email response management system monitors. When the Mail Reader process (RB_MAIL_READ) analyzes the email, the presence of an XML header causes the system to place the email in the structured email queue for further processing by the Structured Email process (RB_STR_EMAIL).

The Structured Email process parses the XML to find the Webform ID, and then it uses that ID to invoke an application service—a set of processing rules that you set up to handle specific email content. If the Structured Email process cannot identify the Webform ID, it routes the email to the exception worklist for the mailbox.

The Web page where customers submit email exists outside the PeopleSoft system. To ensure proper handling of structured email, the email generated by the external Webform must include a WEBFORM_TEMPL_ID tag with a Webform ID that you set up within the PeopleSoft system. You define the ID on the Webform Template page, where you also select the application service that handles email with that ID. The Webform Template page has a preview option so that you can see the expected format of all emails with the ID. Validate the actual email that the external Web page generates against the expected format that appears in the preview.

Because the Webform where the structured email originates is external to the PeopleSoft system, its design is completely up to you. For example, you could use a Webform exclusively for inquiries about the status of a service order, or you could use the same Webform for several types of inquiries. Regardless of how you design the Webform, it is your responsibility to ensure that the email it generates always contains a unique Webform ID and a structure that matches the structure of the Webform template within the PeopleSoft system.

Important! When you design Webforms, always set the MIME part to text/plain to ensure the proper handling of generated structured emails in ERMS.

Click to jump to top of pageClick to jump to parent topicApplication Services

Multiple Webforms can use the same application service. Application services accept input from the Structured Email process, evaluate the input, and return parameters to the Structured Email process, which then sends a reply to the email.

Application Service Definition

Application services consist of the following elements:

Message Definitions

The PeopleTools message definition that an application service references defines the structure of the email that the application service can process. A message definition consists of at least two elements:

The message definition for the service order inquiry message that is described in the preceding examples looks like this:

<?xml version="1.0"?> <Message> <MsgData> <Transaction> <RF_SO_HDR class="R"> <SO_ID></SO_ID> </RF_SO_HDR> <RB_WEBFORM_SBR class="R"> <WEBFORM_TEMPL_ID></WEBFORM_TEMPL_ID> <FROM_ADDRESS></FROM_ADDRESS> </RB_WEBFORM_SBR> </Transaction> </MsgData> </Message>

Delivered Application Services

The following table lists the application services that PeopleSoft delivers. These are all simple inquiry responses. For example, the CASE_INQUIRY application service accepts a case ID and sends a reply with the case status.

Application Service ID

Description

CAPTURE_STATUS

Order Status Inquiry

Accepts the capture ID (the order number) and, if the ID is valid and the email is from is the primary email address of the order contact, replies with the status of the order.

CASE_INQUIRY

Case Status Inquiry

Accepts the case ID and, if the ID is valid verifies that the email is from an address that is associated with the case contact (or the alternate contact for help desk cases).

If the email's From address is valid for the case, the application service replies with the status of the case. The reply is sent to the inbound email's from address, regardless of the email address that is associated with the case. Recipient tokens are resolved for the case contact, even if the email is sent to the alternate contact.

If the email's From address isn't valid for the case, the system send a reply informing the recipient that the case information is not valid.

CREATE_CASE

Create Case

Accepts information that users provide on category, specialty type, detail, summary (required) and case description, and creates cases. The system identifies the incoming email address with an existing customer or person record. If successful, it creates a case for the user based on the setting of the business unit (specified in the corresponding mailbox definition). The system prepopulates the case with default field values that is set up for that business unit from the Case Defaults page, if the user didn't enter all the information on the webform.

If the user cannot be identified, one of these happens:

  • The mail reader process creates a user based on the setting of the business unit associated with the mailbox, if the mailbox is configured to create a new user when the situation occurs. This new user is created with a role type that matches the type of the mailbox (the user has a role of consumer if the mailbox type is external, and a role type of worker if the mailbox type is internal). It uses the email address to form the user's first and last names. In an example where [email protected] is the incoming email address, the user's first name is stranger@ and the last name company.com.

  • The system assigns the unknown user (specified in the System Installations page for ERMS) to the incoming email, if the mailbox is configured to use the system setting. There's no role type associated to this user. In this case, the system does not create a case of the user and the incoming email is routed to the default group worklist.

If the application service creates a case successfully, the system sends a confirmation email with the new case ID to the user. Otherwise, the system sends the email to the default group worklist specified in the mailbox definition and let it handled by the next available agent, and sends an email acknowledgement to the user.

Note. The system routes structured email requesting case creation to the default group worklist for manual processing in these situations as well: when the identified user is associated with multiple roles, when the system has identified multiple users, or when the identified user cannot be associated with the business unit specified in the mailbox definition.

SERVICE_ORDER_STATUS

Accepts a service order ID and, if the ID is valid, replies with the status of the service order and all service order lines.

PeopleSoft also delivers the application classes and message definitions that are referenced in the application service definitions.

See The Mail Reader Process (RB_MAIL_READ).

Click to jump to top of pageClick to jump to parent topicStructured Email Processing

Structured email processing follows this sequence:

  1. A customer submits data using a Webform.

  2. The Webform creates an XML-formatted email message containing transaction information, a Webform ID, and the customer's email address.

  3. The email arrives in an mailbox that is monitored by your email response management system (ERMS), and the presence of the XML header causes the Mail Reader process to place the email in the structured email queue.

  4. The Structured Email process parses the email to find the Webform ID and then looks at the Webform definition to identify the associated application service.

    If there is not a valid Webform ID, the email is routed to the structured email exception worklist for the mailbox, and an administrator can troubleshoot the Webform where the email originated. Normally, this occurs only in the test environment; the notifications help you identify issues with the submit processing on your Webforms (which are external to the PeopleSoft system).

  5. The Structured Email process converts the email body to the input format (rowset, XML, or a custom input type) that you selected for the application service that is associated with the Webform definition, then passes the data to the application class that you selected for the application service.

  6. The application class processes the information that the Structured Email process passes to it and returns the appropriate parameters.

    The application class returns an outcome (Success, Failure, or Error) and an optional correspondence template package to use when replying. It also returns the key values for the transaction that was processed; the Structured Email process then passes these keys to correspondence management to be used when resolving transaction-related token.

  7. The Structured Email process replies to the email using either the correspondence template package that the application service returned or a default correspondence template package that you specified for the Webform.

    Each Webform definition has three default correspondence template packages, one for each possible outcome (Success, Failure, or Error).

  8. The Structured Email process removes the original email from the structured email queue.

The following diagram illustrates the process flow from the time the Structured Email process reads the email until it finishes processing it:

Structured email process flow

See Also

ERMS Processes

Click to jump to top of pageClick to jump to parent topicDefining Application Services

To define application services, use the Application Services (RB_APPSRV_DEFN) component.

This section discusses how to:

Click to jump to top of pageClick to jump to parent topicPages Used to Define Application Services

Page Name

Object Name

Navigation

Usage

Application Services Setup

RB_APPLSRV_SETUP

Set Up CRM, Product Related, Multichannel Definitions, Email, Define Servers and Security, Application Services, Application Services Setup

Define application services.

Application Services Saveas

RB_APPSRV_SAVEAS

Click the Clone Application Service button on the Application Services Setup page.

Clone an existing application service definition.

Application Service Reference

RB_APPSRV_XREF

Set Up CRM, Product Related, Multichannel Definitions, Email, Define Servers and Security, Application Services, Application Service Reference

Review a list of Webforms that use an application service.

Service Order Webform

RB_SO_WEBFORM

Set Up CRM, Product Related, Multichannel Definitions, Email, Sample QA Webforms, Service Order Webform

Use the sample webform to test the structured email process for sending service order status information.

CallCenter Webform

RB_CC_WEBFORM

Set Up CRM, Product Related, Multichannel Definitions, Email, Sample QA Webforms, CallCenter Webform

Use the sample webform to test the structured email process for sending case status information.

Order Capture Webform

RB_ORDER_WEBFORM

Set Up CRM, Product Related, Multichannel Definitions, Email, Sample QA Webforms, Order Capture Webform

Use the sample webform to test the structured email process for sending sales order status information.

Create Case Webform

RC_CASE_WEBFORM

Set Up CRM, Product Related, Multichannel Definitions, Email, Sample QA Webforms, Create Case Webform

Use the sample webform to test the structured email process for creating new cases.

Click to jump to top of pageClick to jump to parent topicCreating the Application Service Message Definition

Access PeopleSoft Application Designer and create the message definition that defines the structure for structured email.

To create the application service message definition:

  1. Create a new message definition.

  2. Add transaction-specific records to the message.

    These are the records that the system uses to process the structured email. For example, the message used to process service order status inquiries includes the RF_SO_HDR record (the service order header record).

  3. Select the Include check box for the fields that are to be included in the structured email.

    The email that your Webform generates must include XML tags for every included field. Content is not required for every included field, but the tags themselves are.

  4. (Optional) Enter an alias for the included fields.

    If you do not enter an alias, the field name is used in the XML tag name. If you do enter an alias, the alias is used.

    For example, if the field SO_ID is included but does not have an alias, then the email that the Webform generates must have <SO_ID> and </SO_ID>. But if you give this field the alias ServiceOrderID, the tags are <ServiceOrderID> and </ServiceOrderID>.

  5. Add the RB_WEBFORM_SBR record to the message.

The following screen shots illustrate a message definition for service order status inquiries.

Click to jump to top of pageClick to jump to parent topicCreating the Application Class That Handles the Structured Email

Access PeopleSoft Application Designer and create the application class by extending the delivered ApplicationServices base class.

The application class that an application service references performs the core processing to respond to the email. It accepts inputs from the Structured Email process and returns parameters that the Structured Email process uses to create an automatic reply.

The delivered ApplicationServices base class is in the RB_MCF_SETUP package under RB_APPS_API subpackage. This class has properties that are used to send input to your application class and to set the output of the application class.

Base Class Properties

The following table lists the relevant properties of the base class:

Property

Description

InputType

This is the input type specified on the Application Services Setup page. This is automatically passed to the application class at runtime by the Structured Email process.

InputMessage

This is the message definition specified on the Application Services Setup page. This is automatically passed to the application class at runtime by the Structured Email process.

EmailId

This is the ID of the email to be processed. This is populated at runtime by the Structured Email process.

Outcome

This is an output property that each application class's ExecuteApi method must set. The value of the Outcome property determines which of a Webform's default correspondence template is used to reply to the email if the CorrespondencePackageid property is not set.

Possible outcomes values are:

  • Success: The email structure is valid and all required data is present.

  • Failure: The structure is valid, but not all required data is present.

  • Error: The structure is invalid.

    This outcome causes the Structured Email process to route the email to the mailbox's default worklist so that it can be processed as an unstructured email.

CorrespondencePackageid

This is an output property that each application class's ExecuteApi method can optionally set.

This is the ID of the correspondence template package to be used when responding to the sender. If no template package is specified, the Structured Email process uses one of the default template packages specified on the Define Webform Templates page. There are different default template packages depending on the outcome.

TransactionRecord

This is an output property that each application class's ExecuteApi method sets.

This is the PeopleTools record object (for example, RC_CASE for cases) for the transaction to which the email pertains. This value is used to pass record information and key values to correspondence management so that it can resolve transactional tokens in the correspondence template.

SubInteractionRecord

This is an output property that each application class's ExecuteApi method sets.

This is the PeopleTools record object that contains subinteraction information for the transaction to which the email pertains. It is passed to correspondence management so that it can create the appropriate subinteractions for the email.

RecepientBoId

This is an output property that each application class's ExecuteApi method sets.

This is the business object ID of the person to whom the reply is sent. This value is passed to correspondence management so that it can resolve recipient tokens in the correspondence template.

RecepientRoleType

This is an output property that each application class's ExecuteApi method sets.

This is the role of the person to whom the reply is sent. This value is passed to correspondence management so that it can resolve recipient tokens in the correspondence template.

Constructor Method

The Constructor method is different for each application service; its name is the same as the name of the application class. For example, CaseStatus is the constructor method for the CaseStatus application class.

The Constructor method has the following parameters, which are used to invoke the base class Constructor method that populates the corresponding properties of the application class:

ConvertEmailBody Method

The ConvertEmailBody method converts the email body text from a string to either XMLDOC or ROWSET format, depending on the input type that you select on the Application Services Setup page. If you select Custom as the input type, you must override this method with code that performs the custom conversion.

ExecuteApi Method

Override the existing ExecuteApi method with your own application-specific code that sets some or all of the following properties:

Parameter

Comments

Outcome

Required.

CorrespondencePackageid

Optional. If this property is not set, the Structured Email process uses the Webform's default correspondence package for the outcome that you set.

TransactionRecord

Required if the correspondence template has transactional tokens (tokens that reference transaction data).

SubInteractionRecord

Required in order to create subinteractions, which associate the automated reply (an interaction) with its related CRM transactions.

RecepientBoId and RecepientRoleType

Required if the correspondence template has recipient-based tokens, such as the recipient's name.

Sample Code for the ExecuteApi Method

The following sample code does three things:

import RB_MCF_SETUP:RB_APPS_API:*; import RB_MCF_SETUP:RB_APPS_API:RB_ERMS_MESSAGE:*; class IssueStatus extends ApplicationServices method IssueStatus(&Input_Type As string, &Msgname As string, &Email_Id As number); method ExecuteApi(); end-class; method IssueStatus /+ &Input_Type as String, +/ /+ &Msgname as String, +/ /+ &Email_Id as Number +/ Rem******************************************************************************; Rem -- Invoke Base Class Constructor before invoking other methods ------------; Rem******************************************************************************; %Super = create ApplicationServices(&Input_Type, &Msgname, &Email_Id); end-method; method ExecuteApi Local Rowset &Case_Rs; Local number &Case_Id; Local string &Status, &Xml_String; Local string &Business_Unit, &Market; Local number &Bo_Cust, &Bo_Contact, &Role_Type_Cust, &Role_Type_Contact; Local Record &Rec1, &Rec2; Rem*****************************************************************************; Rem -- Get Case Id from the Rowset Passed in to this Class -----------; Rem*****************************************************************************; &Rec1 = CreateRecord(Record.RC_CASE); &Case_Id = %This.InputRowset.GetRow(1).RC_CASE.CASE_ID.Value; %This.TransactionRecord = &Rec1; &Rec2 = CreateRecord(Record.RBC_SUBINT_WRK); %This.SubInteractionRecord = &Rec2; SQLExec("SELECT BUSINESS_UNIT,RC_STATUS,BO_ID_CUST,BO_ID_CONTACT, ROLE_TYPE_ID_CUST,ROLE_TYPE_ID_CNTCT,MARKET FROM PS_RC_CASE WHERE CASE_ID=:1", &Case_Id, &Business_Unit, &Status, &Bo_Cust, &Bo_Contact, &Role_Type_Cust, &Role_Type_Contact, &Market); %This.Outcome = "F"; If All(&Business_Unit) Then Rem***************************************************************************; Rem --------- This indicates the Case_Id is valid ---------------------------; Rem***************************************************************************; MessageBox(0, " ", 17834, 70333, "Bo Id Cust from Email is " | %This.BoIdCust); MessageBox(0, " ", 17834, 70333, "Bo Id CONtACT from Email is " | %This.BoIdContact); MessageBox(0, " ", 17834, 70333, "Bo Id Cust From Case is " | &Bo_Cust); MessageBox(0, " ", 17834, 70333, "Bo Id CONtACT from Case is " | &Bo_Contact); If (&Market = "FIN") Then Rem************************************************************************; Rem ---- Valid Finacial Case, hence set the outcome to Success ----------; Rem************************************************************************; %This.Outcome = "S"; Else Rem************************************************************************; Rem ---- InValid Finacial Case, hence set the outcome to Error ----------; Rem************************************************************************; %This.Outcome = "E"; End-If; If (%This.Outcome = "S") Then &Rec1.CASE_ID.Value = &Case_Id; &Rec1.BUSINESS_UNIT.Value = &Business_Unit; &Rec1.SelectByKey(); %This.TransactionRecord = &Rec1; Rem **********************************************************************; Rem --- Populate the Receipient Details for Correspondence Management ----; Rem **********************************************************************; %This.RecepientBoId = &Rec1.BO_ID_CONTACT.Value; %This.RecepientRoleType = &Rec1.ROLE_TYPE_ID_CNTCT.Value; /* Prepare RBC_SUBINT_WRK for Sub Interactions */ &Rec2 = CreateRecord(Record.RBC_SUBINT_WRK); &Rec2.PNLGRPNAME.Value = "RB_WEBFORM_DEFN"; &Rec2.MARKET.Value = "GBL"; &Rec2.CREATE_SUBINT_IND.Value = "Y"; &Rec2.SUBINT_OBJ_TYPE.Value = "CASE"; &Rec2.BUSINESS_UNIT_RI.Value = &Business_Unit; &Rec2.SETID_RI.Value = ""; &Rec2.OBJECT_ID.Value = String(&Case_Id); &Rec2.BO_ID_CUST.Value = &Bo_Cust; &Rec2.ROLE_TYPE_ID_CUST.Value = &Role_Type_Cust; &Rec2.ROLE_TYPE_ID_CNTCT.Value = &Role_Type_Contact; %This.SubInteractionRecord = &Rec2; End-If; End-If; end-method;

Click to jump to top of pageClick to jump to parent topicDefining Application Services

Access the Application Services Setup page.

Clone Application Service

Click to access the Application Services Saveas page and clone the current application service definition.

Application Class ID, Package Tree Viewer, and Application Class Path

Enter the ID and path for the application class that processes the email. Click the Package Tree Viewer link to access the Application Packages Lookup page, where you can browse for application classes and select one to use.

Input Type

Select the format of the input that the Structured Email process passes to the application class. Rowset is normally the easiest format for application classes to work with. Other options are Custom and XMLDoc.

Inbound Message

Select the message definition that controls the expected format of the XML in the email body and that is used when passing rowset data between the Structured Email process and the application class.

Click to jump to top of pageClick to jump to parent topicCloning an Existing Application Service Definition

Access the Application Services Saveas page.

Application Services and Description

Enter names and descriptions for the application services you want to create. When you click the OK button, the system creates these new application service definitions as clones of the application service from which you accessed this page.

Click to jump to top of pageClick to jump to parent topicReviewing a List of Webforms That Use an Application Service

Access the Application Service Reference page.

This page lists the Webform templates that reference this application service.

Click to jump to top of pageClick to jump to parent topicDefining Webform Templates

This section discusses how to:

Click to jump to top of pageClick to jump to parent topicPages Used to Define Webform Templates

Page Name

Object Name

Navigation

Usage

Define Webform Templates

RB_WEBFORM_DEFN

Set Up CRM, Product Related, Multichannel Definitions, Email, Define Servers and Security, Webforms, Define Webform Templates

Create Webform IDs and associate them with application services and default correspondence template packages.

Webform Saveas

RB_WEBFORM_SAVEAS

Click the Clone Webform button on the Define Webform Templates page.

Clone an existing Webform template.

Click to jump to top of pageClick to jump to parent topicDefining Webform Templates

To define webform templates, use the Webforms (RB_WEBFORM_DEFN) component.

Access the Define Webform Templates page.

Webform Template

Displays the webform template you entered. The Structured Email process uses this ID to match an inbound email to the parameters that you enter on this page. When you set up your external Webform, be sure the email it generates includes this ID in the WEBFORM_TEMPL_ID tags.

Language Code

Select the language of the default reply templates. This language code limits the selections in the Correspondence Management Package Details for Responses group box.

Clone Webform

Click to clone the current Webform definition.

Application Service Details

Application Services

Select the application service to be invoked when the system receives an email with this Webform ID.

Correspondence Management Package Details for Responses

Auto Response for Valid Data

Select a default correspondence template to use when the application service outcome is Success.

Auto Response for Invalid Data

Select a default correspondence template to use when the application service outcome is Failure.

Auto Acknowledgement

Select a default correspondence template to use when the application service outcome is Error.

See Setting Up Correspondence Templates.

Click to jump to top of pageClick to jump to parent topicCloning Webform Templates

Access the Webform Saveas page.

Webform Template and Description

Enter names and descriptions for the Webform definitions you want to create. When you click the OK button, the system creates these new Webform definitions as clones of the Webform definition from which you accessed this page.