+ Start a Discussion

Cloning record not coping read-only fields

I have create a custom APEX process which clones a custom record when certain values are saved.


My issue -  For users where fields are read-only, these fields are not getting cloned. When system administrators clone records, the values are cloned correctly.


It's very strange - clone code snippit 


if (createClone){
	Vacancy__c clonedVac = updatedVacancies[0].clone(false,true );
		//clonedVac.Credit__c = null;
		clonedVac.Status__c = 'New Call';
		// @BUGFIX @date 1/11/10 @by MG
		clonedVac.Vacancy_Proof__c =   updatedVacancies[0].Vacancy_Proof__c;
		clonedVac.On_Rerun__c = true;
		clonedVac.Action__c = null;
		insert clonedVac;
		createClone = false;


Any pointers welcome - thanks


you can remove "with sharing" from your class and try if it works.


Thanks for responding.


Already tried that, I thought that too. The entire class is set to run as system.


Any more idea's?