Archive for December, 2021

Successfactors : Adding attachment to MDF Objects via OData

December 3, 2021

In order to upsert into an MDF Object which have attachment, first you have to upsert into the Attachment entity with the base64 encoded File String. This upsert will return the attachment ID. Then retrieve the attachment ID from the response and upsert into the MDF object. The attachment id can be retrieved with XPatch expression like this.

<uri>Attachment(attachmentId=<xsl:copy-of select="substring-after(//atom:entry/atom:content/m:properties/d:key,'Attachment/attachmentId=')"/>)</uri>

After this, Upsert the attachment using this attachment ID wtih payload looking like this:

{
        "cust_ParPaySlip_externalCode": "bbbb",
        "cust_PayrollPeriod": "/Date(1625316265000)/",
        "cust_AttachmentNav": {
            "__metadata": {
                "uri": "Attachment(attachmentId=16840)"
            }
        },
        "__metadata": {
          "uri": "cust_ListPaySlip"
        }
      }