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 The input type specified on the Application Services Setup
page. This input type is automatically passed to the application class at runtime by the Structured Email process.
InputMessage The message definition specified on the Application Services
Setup page. This definition is automatically passed to the application class at runtime by the Structured Email process.
EmailId The ID of the email to be processed. This ID is populated at
runtime by the Structured Email process.
Outcome An output property that each application class's ExecuteApi
method must set. The value of the Outcome property determines which Webform default correspondence template is used to reply to the email if the CorrespondencePackageid property is not set.
Possible outcome 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.
Property Description
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. Different default template packages exist 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 An output property that each application class's ExecuteApi method sets.
This property 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 An output property that each application class's ExecuteApi method sets.
This property 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 An output property that each application class's ExecuteApi method sets.
This property 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:
• InputType
• InputMessage
• EmailId
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 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:
• If the case ID entered in the webform is not in the system, then it returns an outcome of F (failure).
• If the case ID entered in the webform is a valid issue in PeopleSoft CRM for Financial Services, the code returns a outcome of S (success).
• If the case ID entered in the webform is in the system, but is not a PeopleSoft CRM for Financial Services issue, then the code returns an outcome of E (error).
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 numb⇒
er); method ExecuteApi();
end-class;
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_T⇒
ype_Contact, &Market);
%This.Outcome = "F";
If All(&Business_Unit) Then
&Rec1.CASE_ID.Value = &Case_Id;
&Rec1.BUSINESS_UNIT.Value = &Business_Unit;
; %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;
To define webform templates, use the Webforms (RB_WEBFORM_DEFN and RB_QA_WEBFORMS) components.
These topics discuss how to:
• Define webform templates.
• Identify email workspace fields for mapping.
• Specify webform and email workspace field mapping.
Perform these tasks to complete the setup of automated mail processing for structured emails.