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
AshwAshw 

Assigning a value in Content version field in after insert get the error as FIELD_INTEGRITY_EXCEPTION, You cannot set custom fields or tags

I have written a trigger logic to update a custom field verion_Id__c with contentversionID but facing the error as "You cannot set custom fields or tags" I need experts to help in fixing the issue. below is the code.
 
if(trigger.IsAfter){
        if(trigger.IsInsert){
            list<ContentVersion> lstObj = [Select id,VersionNumber,version_id__c from ContentVersion where Id IN: Trigger.newMap.keySet()];
            for(ContentVersion con: lstObj ){
                if(con.VersionNumber == '1' ) con.version_id__c = con.Id;
            }
            update lstObj;
        }
    }

​​​​​​​
AnudeepAnudeep (Salesforce Developers) 
Unsure how to fix this exactly but have seen this issue in the past. Updating the API version of the class has fixed the error in the past

I suggest looking at the following posts as well

https://developer.salesforce.com/forums/?id=906F00000008lcnIAA

https://developer.salesforce.com/forums/?id=906F0000000910YIAQ