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
Cesar Ramirez Vasquez005391619375684564Cesar Ramirez Vasquez005391619375684564 

I am getting the following error trying to update an object Field is not writeable: Propiedad__c.User__c

I am trying to update my custom object Propiedad__c that has a master-detail relationship with a custom object called User__c; that master detail relationship already has read/write permissons; the worst part is that i dont even wanna update that field so im not setting any value but i keep getting the error Field is not writeable: Propiedad__c.User__c.
This is the snipet of my code that is failing:
public void actualizar(){
    Cookie lol = ApexPages.currentPage().getCookies().get('ID');
    try{
    Propiedad__c p = new Propiedad__c(id = prop.id);
    p.AmbosIdiomas__c= prop.AmbosIdiomas__c;
    p.Ba_os__c = prop.Ba_os__c;
    p.Canton__c = prop.Canton__c;
    p.Caracteristicas_Especiales__c = prop.Caracteristicas_Especiales__c;
    p.Caracteristicas_Especiales_EN__c = prop.Caracteristicas_Especiales_EN__c;
    p.Categoria__c = prop.Categoria__c;
    p.Descripcion__c = prop.Descripcion__c;
    p.DescripcionEN__c = prop.DescripcionEN__c;
    p.EmailDue_o__c = prop.EmailDue_o__c;
    p.Habitaciones__c = prop.Habitaciones__c;
    p.Lote__c = prop.Lote__c;
    p.Nombre__c = prop.Nombre__c;
    p.NombreDue_o__c = prop.NombreDue_o__c;
    p.Precio__c = prop.Precio__c;
    p.Provincia__c = prop.Provincia__c;
    p.Renta__c = prop.Renta__c;
    p.Telefono1__c = prop.Telefono1__c;
    p.Telefono2__c = prop.Telefono2__c;
    p.Tipo__c = prop.Tipo__c;
    p.Venta__c = prop.Venta__c;

   
    update p;
    if (FileCount != null && FileCount != ''){
    SaveAttachments();
    }
    if (language == 'ES'){
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Confirm,'Propiedad actualizada con exito.'));
    }
    else{
    ApexPages.addMessage(new ApexPages.Message(ApexPages.Severity.Confirm,'Property successfully updated.'));
        }
       
        refreshEdit();
    }
    catch(Exception B){
     ApexPages.addmessages(B);
    }
    }

Prop is filling in the constructor and is bind to my VF that way i can get the new values; but im unable to update
Cloud_forceCloud_force
check all the fields you are populating as part of this code, may be you are creating data for any formula field. Formula fields/roll up summary fields are read only,

thanks,
http://www.forcexplore.com/2014/01/salesforce-interview-questions-part-i.html