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);
}