I am currently developing an external application that uses the Salesforce REST API to consume.
The POST method to the endpoints /services/data/v47.0/sobjects/ContentNote
&& /services/data/v47.0/sobjects/ContentDocumentLink
work as expected and the Note I am creating shows up in Salesforce on the desired Account.
However, the CreatedById completely ignores the ID i have specified and just uses my name no matter what. I have enabled Set Audit Fields upon Record Creation
in the permission sets for each user, or else it would be throwing a 400 Bad Request
.
To start off, I don't even know how it is grabbing my name as the CreatedById, as I am using a seperate API account for the Username/Password authorization flow, and I even tested it by logging into a different account and creating it.
This is the payload for the /services/data/v47.0/sobjects/ContentNote
endpoint.
$"{{\"Title\":\"{title}\", \"Content\":\"{messageEncoded}\", \"CreatedById\":\"{createdById}\", \"OwnerId\":\"{createdById}\"}}";
And this is the payload for the /services/data/v47.0/sobjects/ContentDocumentLink
endpoint
$"{{\"ContentDocumentId\":\"{cnm.Id}\", \"LinkedEntityId\":\"{accountId}\", \"ShareType\":\"V\"}}";
Rest assured that the ID's are where they need to be, because it is clearly creating the note in my org. cnm.Id is the ID of the created note for the ContentNote endpoint.
Any ideas? Is this possible to do, or is this just another Salesforce quirk.