
Email Channels are used in Sales and Service Cloud Version 2 to manage two-way email communication between customers and the organization.
This allows the system to recognize the customer based on the sender’s email address and perform the necessary party and case type assignments. These assignments can be done using either Business Rules or Custom Code Extensions.
For detailed steps on how to create an Email Channel, you can refer to the following SAP Note:
https://me.sap.com/notes/0003247300
In this blog, we will define Case Parties by adding a Custom Code Extension to the Email Channel.
1.1 Go to Settings → Integration → Communication Configuration and click the New Configuration button.
1.2 Assign a name and select the communication system. Value mapping is not required for this example.
1.3 Scroll down to the HTTP Data section and click on the Search and Add button.From the list, find and add "Email to Case: Determine Parties."
1.4 Define a path for your Communication System, then click Save and Activate to complete the process. Your Communication Configuration is now created.
2.1 Select the Email Channel where you want to add the configuration, then click the Edit button at the bottom of the page.
2.2 In the Determination Rules section, enable Party Determination From Custom Code Extensions, and save your changes. This adds the configuration to the selected channel.
Note: You must activate this setting individually for each channel. You can distinguish between channels using the emailAddress field in the event.
3.1 Event Structure
When you set up the communication system connection and send an email to the defined channel address, the system automatically identifies an active contact—if one exists.
In that case, the account and contact objects are added to the event. If no matching contact exists in the system, these objects are not included.
{ "subject": "Mail Subject",
"origin": "EMAIL",
"channel": {
"id": "fab75ee7-50c7-11ef-8827-579205a08065",
"name": "Channel Name",
"emailAddress": "{$channelEmailAddress}",
},
"caseType": "Z_Type", "isRecommendedCaseType": false,
"account": {
"id": "11ee82f8-020d-29de-afdb-816187020a00",
"isDeleted": false,
"isMain": false,
"partyType": "ACCOUNT"
},
"contact": {
"id": "11ee4bca-2589-137e-afdb-818517020a00",
"isDeleted": false,
"isMain": false,
"partyType": "CONTACT"
},
"description": { "content": "Mail Subject", "noteId": "9d75e981-08ad-11f0-a71f-652ded6ef860", "noteType": "S001" },
"relatedObjects": [ { "objectId": "9c89b4d7-08ad-11f0-b495-c10c83bb41b2", "type": "39", "role": "1" } ],
"timePoints": { "reportedOn": "2025-03-24T12:42:03Z" },
"emailInteraction": {
"id": "9c89b4d7-08ad-11f0-b495-c10c83bb41b2",
"senderEmailAddress": "{$senderEmailAddress}",
"toRecipients" : [ "$channelEmailAddress}" ]
},
"isLastResponseByCustomer": true}
3.2 Response Structure
For example, suppose you want to assign emails from the domain sapservicecloud.com to a dummy account. This can be achieved using the following Node.js code blocks.
Since UUIDs may differ across tenants, it is not recommended to use fixed values. Instead, handle them dynamically. Alternatively, you can detect the tenant and prepare a conditional structure to avoid delays caused by additional API calls.
module.exports = {
main: async function (event) {
console.log("Incoming Event: ",event.data);
let payload = {};
const eventData = event.data;
const senderEmail = eventData.emailInteraction.senderEmailAddress;
if(senderEmail.endsWith("@sapservicecloud.com")){
payload.accountId = {$exampleUUID};
}
return payload;
}
}
Below are the parties and their corresponding field names to be used in the response payload:
Add these to the payload in your response. If everything is configured correctly, you should see your email in the Case list, associated with the specified account.
If the case is not created, go to Settings → Cases → Case Auto Creation Monitoring.
Find your email and check the error message. Click the ID to view the detailed error information.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.