1

Hi friends i got a requirement to get the mail id of the person to sent an email alert.But i have two conditions to work on this

Like

 OR(IF( CONTAINS( Mail__c , "pavanobbeli@gmail.com") ,
     "", "pavanobbeli89@gmail.com"),
      IF( CONTAINS( Mail__c ,
      "pavanobbeli89@gmail.com") ,"", "pavanobbeli@gmail.com")) 

But it throws an error like expected Boolean received text.When i had work with single value it works fine.

Please provide suggestions where i had went wrong.

2

OR expects an array of Boolean parameters, then returns true if any of them are true, else it returns false. In your case, you are yielding String from your IF statements, and passing them into an OR function. The following would work, though it's unclear if it's what you're after:

OR(
    CONTAINS(Mail__c, "address1"),
    CONTAINS(Mail__c, "address2")
)

You should use the above as your criteria, then use a Field Update to actually set the value.

|improve this answer|||||
  • But i want to validate email in Mail_c and then update the value @Adrian Larson – Pavan tej Jul 14 '16 at 13:04
  • If you want to update the value, you should be using Workflow Rule, not a Validation Rule. – Adrian Larson Jul 14 '16 at 13:06
  • Ya i am using the above condition in a workflow rule.But when i try to use like with out OR and only single condition it 's updating correctly @Adrian Larson – Pavan tej Jul 14 '16 at 13:07
1

I think you want to use CASE:

CASE(Mail__c, 
CONTAINS(Mail__c,"pavanobbeli@gmail.com"),"pavanobbeli89@gmail.com",
CONTAINS( Mail__c ,"pavanobbeli89@gmail.com"),"pavanobbeli@gmail.com")   

EDIT

According to the docs, you can't use functions in your formula that return true or false which is what CONTAINS does. Instead, it needs to return a non-boolean value. Since these seem to be complete addresses, try the following and see if it works for you :

CASE(Mail__c, 
"pavanobbeli@gmail.com","pavanobbeli89@gmail.com",
"pavanobbeli89@gmail.com","pavanobbeli@gmail.com")   
|improve this answer|||||
  • Error: Incorrect number of parameters for function 'CASE()'. Expected 4, received 5 @crmprogdev – Pavan tej Jul 14 '16 at 13:13
  • Remove the Mail__c at the very start of the statement and see if that works, but I'd expect you to need it. Actually, you probably need to add the object name in front of Mail__c. – crmprogdev Jul 14 '16 at 13:15
  • And now agian Error: Incorrect argument type for function 'CASE()'. @crmprogdev – Pavan tej Jul 14 '16 at 13:19
  • See my edited answer and see if works for you. – crmprogdev Jul 14 '16 at 13:31
  • I found another solution it's working fine.I will give a try to solution also.@crmprogdev – Pavan tej Jul 14 '16 at 13:42
-1

Hey i found the solution the solution to use IF with Contains functions.Here the solution

 IF(CONTAINS( Approver_Mail__c,"pavanobbeli@gmail.com"),"pavanobbeli89@gmail.com",
 IF(CONTAINS( Approver_Mail__c , "pavanobbeli89@gmail.com"), "pavanobbeli@gmail.com",NULL ))

It works perfectly fine thank you very much every one.

|improve this answer|||||
  • The root cause is that you were trying to put your field update in your criteria, no? – Adrian Larson Jul 14 '16 at 13:42
  • No.I am trying this in an standard approval process with a field update.Whenever a record is approved in a specific criteria like if reassigned. It's working fine.@Adrian Larson – Pavan tej Jul 14 '16 at 13:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.