+ Start a Discussion
DeptonDepton 

Two formulas in one!

Hi,

 

 

I have 2 formulas, each of them tells to the logged user if their are selected in a custom look up : Lookuptouser/Lookuptouser2:

 

 

1: IF( Lookuptouser__r.Id  = $User.Id, "Yes", "No")

2: IF ( Lookuptouser2__r.Id = $User.Id, "Yes", "No")

 

 

How can I put these two formulas in one.

 

So instead of checking individually, I want to check if I am in Lookuptouser OR Lookuptouser2, with a Yes or NO as the answer

Best Answer chosen by Admin (Salesforce Developers) 
ashish raiashish rai

Hi,

Have you tried this:

If (AshishPackage__User__r.Id =  $User.Id ,'yes' ,if(AshishPackage__User2__r.Id =  $User.Id,'yes','no') )

All Answers

ashish raiashish rai

Ans:Hi,

 

Try the below formula:

IF( Lookuptouser__r.Id  = $User.Id, "Yes", "No") || IF ( Lookuptouser2__r.Id = $User.Id, "Yes", "No")

DeptonDepton

Thank you for getting back to me, but I got this error:

 

 Error: Incorrect parameter for function 'or()'. Expected Boolean, received Text

 

:)

 

ashish raiashish rai

Hi,

Use the below one:

If(AshishPackage__User__r.Id  =  $User.Id ,True,False) || If(AshishPackage__User2__r.Id  =  $User.Id ,True,False)

DeptonDepton

Thank you again:

 

Error: Formula result is data type (Boolean), incompatible with expected data type (Text)

 

 

I am trying adding AND & OR without success.....

ashish raiashish rai

Hi,

Its working at my end.I have used this as validation rule. Think you are not using this as Validation. So for formula field  try below one it will work for you:

 

If (AshishPackage__User__r.Id =  $User.Id ,'yes' ,if(AshishPackage__User2__r.Id =  $User.Id,'yes','no') )

DeptonDepton

Hi,

 

Not for me is not a validation

 

I just  want the formula field displaying YES, if user is selected in any of Both lookups and NO in case that the logged user is not selected.

 

I want to use it for other purpose. Is not a validation!

 

Thank you

ashish raiashish rai

Hi,

Have you tried this:

If (AshishPackage__User__r.Id =  $User.Id ,'yes' ,if(AshishPackage__User2__r.Id =  $User.Id,'yes','no') )

This was selected as the best answer
DeptonDepton

Thank you Ashish!!

 

I thought I had tried it before, but......not!!!

 

:)))