function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NakataNakata 

IF function in email template

Good day, 

 

I trying to create a condition in order to get the value appear in email template

 

the condition like following 

 

If approved reason = "Not Exceed" then show "Other approve reason" which is user entry value, i put it in this way but when i try to test the template, it doesn't show me the "Other approve reason" value

 

** Approved reason is picklist whereas "Other approve reason" is textfield

 

My try on following, but it doens't show me the "Other approved reason" value, any clue ?

 

 

{!IF(ISPICKVAL(myObject.Approved_Reason__c,"Not Exceed"),myObject.Other_approved_reason__c,"") OR 
!IF(ISPICKVAL(myObject.Approved_Reason__c,"Exceed"),"Exceed","")
}

 

Thanks in advance !

 

kyle.tkyle.t

I am not 100% sure what you are doing with the OR statement.  I believe you want to do this (line breaks entered for readability):

 

{!IF(ISPICKVAL(myObject.Approved_Reason__c,"Not Exceed"),

myObject.Other_approved_reason__c,

IF(ISPICKVAL(myObject.Approved_Reason__c,"Exceed"),

"Exceed",

"")

}

 

Basically "If Approved Reason = Not Exceed then displyay Other Approved Reason, othewise check if Approved Reason = Exceed and if it does display Exceed, otherwise display nothing

NakataNakata

using OR is to check other selected value from picklist , should i use OR ?

kyle.tkyle.t

OR is a binary operator (ie, true or false) but it looks like you are trying to pass the values of the two IF statements into the OR when it should take "true" or "false" as arguments.

NakataNakata

I managed to found the issue, it is due to Multi-picklist, i using includes() and it work now, thanks Klye.t for the help :)