Outbound Email – Using Mailforms
Step by step guide on how to trigger an email through mail forms using standard sap crm rule policy on service request transaction saved.
SPRO->Customer Relationship Management->Marketing->Marketing Planning and Campaign Management ->Maintain Attribute Contexts for Mail Forms
- Maintain Attribute Contexts for Mail Forms.- you can define custom Attribute context and assign custom structure with all fields to get visible on UI.
- Mail form should be configured on UI with its usage and attribute context.
If you are on CRM 7.0 or above version sending e-mail when service request is saved is a standard functionality and sending mail using mail forms can be achieved by Rule policy with Intent Driven Interaction context.
SPRO->Customer Relationship Management->Interaction Center WebClient->Additional Functions ->Intent-Driven Interactions->
- Service Manager – Select the appropriate profile (ex. Z_ERMS_ROUTE) and in called services you need an entry of RE_RULE_EXEC.
- Define Repository – Select ICRULE Intent Driven Interaction (IC WebClient) Context where you have define custom attributes with custom Fact Gathering Srvc and its attribute context class, actions and its parameters.
3. Define Events in Repository- Use standard event as BTCreated.
4. Define Services (Action handling) and fact gathering services in Customising in E-Mail Response Management System -> Service Manager -> Define Services and assign them to attributes in Define Repository.
for custom transaction related attributes you must create a copy of this service id and If you defined a new class, it must implement the IF_CRM_ERMS_SERVICE interface.
Go to business role IC_MANAGER and configure a rule policy as below.
- Create New policy and add your Business Role at the header.
- Add IC Events ‘OrderSaved’ at the header that is configured..
- Create rules as Condition – If Current Event Equals Order was saved & Action – Send Out-Going E-Mail Using Mail Form
- E-Mail Subject – ‘Trigger Email’.
- Sender’s E-Mail Adress ’email id’
- Mail Form ‘ZMailform that is configured.
To get context attributes values of mail form you can refer below class and its method.
Get Customer id based on partner function of that service request and then get email id of that customer using BAPI_BUPA_CENTRAL_GETDETAIL.
Use standard SEND_ERMS_MAIL method to send email to customer.
Use standard cl_crm_erms_utils=>link_ir_email to link email and service request.
To raise a custom event in intent driven interaction use below code.
DATA : lr_event TYPE REF TO cl_crm_ic_event. DATA : lr_event_srv TYPE REF TO if_crm_ic_event_srv. CLASS cl_crm_ic_services DEFINITION LOAD. CREATE OBJECT lr_event. lr_event->set_name( 'BTCreated' ). lr_event_srv = cl_crm_ic_services=>get_event_srv_instance( ). lr_event_srv->raise( lr_event ).