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
Øyvind Borgersen 10Øyvind Borgersen 10 

Create/Update contentversion


I'm trying to update some custom field on the contentversion, based on a change in another record, but it's failing. It seems like the it cannot find the contentversion to update even though I'm using I'm finding the specific recordId. 

I've also tried to create a new contentversion but get the following error: Value of class core.filemanager.FileBlobValue is not a ValueType: STRING

Anyone has a working apex or flow to update a contentversion?

ShivankurShivankur (Salesforce Developers) 
Hi Øyvind,

As per the documentation (, You can only update a version if it is the latest version and if it is published.

Please check with points to be considered while updating the ContentVersion Object to avoid any errors.

Hope above information helps, Please mark as Best Answer so that it can help others in the future.

mukesh guptamukesh gupta

There are two ways to convert a Blob to a string in Apex. Depending on how the Blob was created, you'll use one or the other:

For content, you should use the base64encode method. This means you'll need to create additional properties or variables in your Apex class, as you wont be able to do this on the sObject itself.

if you need any assistanse, Please let me know!!

Kindly mark my solution as the best answer if it helps you.