Error writing client tab in V10 user fields

2

I have the following code before writing a customer's token in certain situations (clients with a NIF starting with 5) change a CDU on the clients tab.

The field is changed but always gives "Error updating user fields". I have already rebuilt all dependencies in ADM.

Code

public override void AntesDeGravar(ref bool Cancel, ExtensibilityEventArgs e)
{
    if (this.Cliente.NumContribuinte.Substring(0, 1) == "5")
        this.Cliente.CamposUtil["CDU_Consentimento"].Valor = 1;

    base.AntesDeGravar(ref Cancel, e);  
}
    
asked by anonymous 08.10.2018 / 17:12

1 answer

2

The problem is that the 1 value is being assigned to a field that is declared as BIT .

The solution is to change the 1 to true :

this.Cliente.CamposUtil["CDU_Consentimento"].Valor = true;
    
09.10.2018 / 19:56