SAP Knowledge Base Article - Public

3377669 - Attachments added to the email template are missing when the Offer Letter is sent via OData API - Recruiting Management

Symptom

Additional attachments from the email template are not attached in the offer letter email when using API.

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

Environment

SAP SuccessFactors Recruiting Management

Reproducing the Issue

1. Create an offer letter using API.

POST .../odata/v2/OfferLetter?$format=json

{
"__metadata":{
"type":"SFOData.OfferLetter",
"uri":"OfferLetter"
},
"applicationId": "xxxx",
"templateId": "xxx",
"sendMode": "pending"
}

2. Email the offer letter as PDF using the function import "sendMailOfferLetter" and sendMode=’emailaspdf’, specify the bodyTemplateId of an email template that has additional attachments.

GET …/odata/v2/sendMailOfferLetter?offerLetterId=xxxxxL&sendMode=’emailaspdf’&bodyTemplateId=xxxL&bodyLocale=’en_US

3. The email is received with the PDF offer letter attached. Additional attachments are missing.

Cause

It is necessary to provide the attachment in the request payload when using OData API.

Resolution

Please refer to the sample below to add attachments in the POST request to create the offer letter, then email the offer letter as PDF using the function import normally.

POST .../odata/v2/OfferLetter?$format=json

{
"__metadata":{
"type":"SFOData.OfferLetter",
"uri":"OfferLetter"
},
"applicationId": "xxxx",
"templateId": "xxx",
"sendMode": "pending",
"attachments": {
           "__metadata": {
                   "uri": "Attachment",
                   "type": "SFOData.Attachment"
               },
               "fileName": "my_additional_attachments.txt",
               "ownerIdType": "NOT_PROVIDED",
               "ownerId": "shared",
               "module": "RECRUITING",
               "viewable": true,
               "fileContent": "dummy"
       }
}

Multiple attachments:

{
"__metadata":{
"type":"SFOData.OfferLetter",
"uri":"OfferLetter"
},
"applicationId": "xxxx",
"templateId": "xxx",
"sendMode": "pending",
"attachments": [{
            "__metadata": {
                    "uri": "Attachment",
                    "type": "SFOData.Attachment"
                },
                "fileName": "my_additional_attachments_1.txt",
                "ownerIdType": "NOT_PROVIDED",
                "ownerId": "shared",
                "module": "RECRUITING",
                "viewable": true,
                "fileContent": "dummy"
        },
{
            "__metadata": {
                    "uri": "Attachment",
                    "type": "SFOData.Attachment"
                },
                "fileName": "my_additional_attachments_2.txt",
                "ownerIdType": "NOT_PROVIDED",
                "ownerId": "shared",
                "module": "RECRUITING",
                "viewable": true,
                "fileContent": "dummy"
      }]
}

Note: API does not pull additional recipients from the email template.

See Also

Keywords

RCM, OData, API, Offer, Candidate, attachment, template, email , KBA , LOD-SF-RCM-API , Webservices & APIs , LOD-SF-RCM , Recruiting Management , LOD-SF-RCM-CAO , Candidate Offers, Offer Letters , Problem

Product

SAP SuccessFactors Recruiting all versions