Defining Application Services
These topics discuss how to:
Create the application service message definition.
Create the application class that handles the structured email.
To define application services, use the Application Services (RB_APPSRV_DEFN) component.
Access the Messages component of Integration Broker to create the application service message definition that defines the structure for structured email.
Refer to the see also reference for more information on managing message definitions.
See the product documentation for PeopleTools: PeopleSoft Integration Broker.
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:
|
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 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.BoId Cust);
MessageBox(0, " ", 17834, 70333, "Bo Id CONtACT from Email is " | %This.BoId Contact);
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;