SAP Knowledge Base Article - Public

3472917 - Issues while creating email interactions over the REST API email-service

Symptom

Image/data in this KBA is from SAP internal systems, sample data, or demo systems. Any resemblance to real data is purely coincidental.

  • The Service Cloud V2 (SCV2) Admin using the "/sap/c4c/api/v1/email-service/emails" REST API service to post replication data to SCV2.
  • The intent is to create email interactions of emails that were already handled in other external systems.
  • Business would like for said email interactions to show up in the corresponding timelines (for example, Business Partner timelines, Agent Desktop Customer Hub timelines etc)
  • Problem - Two potential issues can occur:
    1. If the administrator is using a Technical User to send the post message to the REST API, the system returns the error:
      {
        "error": {
          "code": "emailInteraction.10040",
          "message": "No employee associated with User",
          "details": null,
          "target": null
        }
    2. In the customer's timeline in the Service Cloud UI, the Sent On date and time of emails is shown as the time of the post message, not the actual time of the "sentOn" date and time included/defined in the JSON or XML content.

Environment

  • SAP Service Cloud Version 2 1.0
  • SAP Sales Cloud Version 2 1.0

Reproducing the Issue

  1. Use any of the following tools:
  2. Use the following Json example:
    {
        "individualCustomers": [
            {
                "id": "MAINTAIN THE BP'S GUID",
                "displayId": "MAINTAIN THE DISPLAY ID"
            }
        ],
        "toRecipients": [
            "john.dow@thecompany.com"
        ],
        "accounts": [],
        "contacts": [],
        "employees": [
            {
                "id": "MAINTAIN THE BP'S GUID OF THE EMPLOYEE",
                "displayId": "MAINTAIN THE DISPLAY ID OF THE EMPLOYEE"
            }
        ],
        "attachments": [],
        "direction": "OUTBOUND",
        "ccRecipients": [],
        "bccRecipients": [],
        "plainContent": "TEST",
        "htmlContent": "TEST",
        "transmissionStatus": "SUCCESS",
        "from": "demo@mycompany-noreply.com",
        "subject": "Test",
        "sentOn": "2024-05-16T14:00:00.000Z"
    }
    • Important note:
      • Ensure the key attributes you need to modified match your system variables.
      • For example, the from email address needs to be that of an actual channel maintained in SCV2, the BP details also need to be what is maintained in master data.
  3. Enter the credentials to access the "/sap/c4c/api/v1/email-service/emails" email service.
    1. Use basic Auth and 
    2. Enter the user credentials of the Technical User or Business User

Cause

Configuration/Implementation issue

Resolution

To resolve both issues:

  • **Pass the "transmissionStatus" Parameter**:
       - Include the parameter `"transmissionStatus": "CREATE"` in the payload.
  • **Ignore User-Related Validations**:
       - Using `"transmissionStatus": "CREATE"` instead of `"transmissionStatus": "SUCCESS"` will bypass validations related to the User, allowing the process to continue without errors.
  • **Correct Date and Time Handling**:
       - With the change to `"transmissionStatus": "CREATE"`, the administrator can specify the `sentOn` date and time, reflecting the actual date and time the email was processed in the original system.

By implementing the above change, the system will correctly handle email interactions, avoiding user validation errors and ensuring accurate timestamp representation.

See Also

Keywords

/sap/c4c/api/v1/email-service/emails , KBA , CEC-CRM-EML , Emails for SAP Sales/Service Cloud , Problem

Product

SAP Sales Cloud and SAP Service Cloud Version 2 1.0