You need to sign in to do that
Don't have an account?
Emmanuel Corona
IF Error
greetings!
I'm working in a trigger with the next sintax
if (opp.stagename=='Ganada' && mapPuntasize.get(opp.id)==0 && opp.Es_Inactiva__c!=1&& (opp.FUNCION__c<>'Costumer Care' ||opp.FUNCION__c<>'Direccion MCM') ){
opp.addError('La Oportunidad debe tener al menos una punta.');
}
But when i test it, i get the error message using a user with Funcion Direccion MCM
So what i'm trying to do is to get the message when the user Funcion is not equal to Costumer or Direccion, whats is wrong? how can i add more than one OR in the if?
Thank you.
opp.FUNCION__c = 'Direccion MCM'
The record which you are testing with has following conditions true as well:
opp.stagename=='Ganada' && mapPuntasize.get(opp.id)==0 && opp.Es_Inactiva__c!=1&&
That's why it is returning error.. what condition you want to satisfy ?
If the stagename=Ganada, puntasiza=0, es_inactiva!=1 and the Funcion is different from Direccion or Costumer Care then send the error message
That is what i'm trying to get :(
Your code should be
if (opp.stagename=='Ganada' && mapPuntasize.get(opp.id)==0 && opp.Es_Inactiva__c!=1&& (opp.FUNCION__c<>'Costumer Care' && opp.FUNCION__c<>'Direccion MCM') ){
opp.addError('La Oportunidad debe tener al menos una punta.');
}
i tried that but it was not working :S
I'm using this:
if (opp.stagename=='Negociar' && mapPuntasize.get(opp.id)==0 && opp.Es_Inactiva__c!=1 && opp.Funcion_propietario__c<>'Costumer Care' && opp.Funcion_propietario__c<>'EV-Network-DR' && opp.Funcion_propietario__c<>'Coordinador-DR'){
opp.addError('La Oportunidad debe tener al menos una punta.');
}
but some times it works and some times no... i don't know if there is a limit
Can you please let me know the scenario when it is not working I mean please put this statement and check value of attributes.
system.debug('==opp.stagename=='+opp.stagename+'===mapPuntasize.get(opp.id)=='+mapPuntasize.get(opp.id)+'======='+opp.Es_Inactiva__c+'======'+opp.Funcion_propietario__c);
and let me know values.