function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion


Hi ,

I am trying to upload documents to content libraries , but i am getting this error eg:- "SOURCE: 'ContentDocumentId' DESTINATION: 'ContentDocumentId' ERROR:ContentDocument ID: id value of incorrect type: Create"

Can anyone suggest what value should i give in ContentDocument ID field.

Thanks in advance
As per salesforce docs,

'To create a document, create a new version via the ContentVersion object without setting the ContentDocumentId. This automatically creates a parent document record. When adding a new version of the document, you must specify an existing ContentDocumentId which initiates the revision process for the document. When the latest version is published, the title, owner, and publish status fields are updated in the document.'

That means you should not be setting the ContentDocumentId,just create the newer version of ContentVersion.Go to below URl to learn more :-

If this helps,please mark this as best answer to help others :)
TM Developer AdminTM Developer Admin
@Vinit_Kumar, this is helpful but the link you provided above no longer exists... Can you provide an updated URL or some examples?

Also I'm trying to create an enhanced Note using a webform app builder (Form Assembly, I'm not a developer) but it shows the required fields are ContentDocumentID.  Even when I select ContentVersion, it still shows ContentDocumentID as a required field.  Can you please explain exactly what fields need to be added and how they should be set (including reference to the parent object), and in what order, to create the initial enhanced Note on an object?