1

I have created a connected app which my client will be using to create cases in Salesforce. On testing the connected app using Postman I was able to get the access token, and also responses for SOQL queries and case creation.

Now when I try to create a content version record, it works and I get Id of the record when I don't put in the OwnerId and the ContentLocation fields, I get a success response. But when I try the same with the OwnerId and ContentLocation fields the below is the error I receive -

If I put in OwnerId -

{
    "message": "Documents in a user's private library must always be owned by that user.",
    "errorCode": "INVALID_STATUS",
    "fields": [
        "OwnerId"
    ]
}

If I put in ContentLocation -

{
    "message": "No such column 'ContentLocation' on sobject of type ContentVersion",
    "errorCode": "INVALID_FIELD"
}

When I dont supply values for the above fields I get an error when I create a ContentDocumentLink record

{
        "message": "You cannot create a link for a document in a private library: ContentDocument ID",
        "errorCode": "FIELD_INTEGRITY_EXCEPTION",
        "fields": [
            "ContentDocumentId"
        ]
    }

1 Answer 1

1

Set the FirstPublishLocationId to the case Id, which will place the file in the case's feed. You can then share it if you need to (which you shouldn't, as it's already attached to the case).

1
  • Wow awesome thanks @sfdcfox.
    – sumchans
    Commented Dec 24, 2023 at 18:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .