I am trying to create a conditional formula for a merge field for a HTML Email Template with the following logic; IF both ICMS ID and Portal ID are present then only show ICMS ID OR IF only ICMS ID is present show that IF only Portal ID is present show that
I created the following formula
{!IF
(AND(NOT(ISBLANK(Case.ICMS_ID__c & Case.Portal_ID__c))), Case.ICMS_ID__c, ""
,
!IF(NOT(ISBLANK(Case.ICMS_ID__c)), Case.ICMS_ID__c, ""
,
!IF(NOT(ISBLANK(Case.Portal_ID__c)), Case.Portal_ID__c , ""
,
}
I am not sure where I am going wrong but the required information is not coming into the email template. If the field is filled out, no information is appearing.
I am not sure where I am going wrong, please help!
EDIT: Have tried the suggestion from below and still no information is appearing
{!IF(AND(NOT(ISBLANK(Case.ICMS_ID__c)),
NOT(ISBLANK(Case.Portal_ID__c))),
Case.ICMS_ID__c, "",
!IF(NOT(ISBLANK(Case.ICMS_ID__c)),
Case.ICMS_ID__c, "",
!IF(NOT(ISBLANK(Case.Portal_ID__c)),
Case.Portal_ID__c , "",
}
EDIT: Have now also tried the below suggestion and the field on the email template is still appearing as blank even if data is entered in both ICMS ID & Portal ID or just one of them.
{!IF(
AND(NOT(ISBLANK(Case.ICMS_ID__c)), NOT(ISBLANK(Case.Portal_ID__c))),
Case.ICMS_ID__c,
IF(NOT(ISBLANK(Case.ICMS_ID__c)),
Case.ICMS_ID__c,
IF(NOT(ISBLANK(Case.Portal_ID__c)),
Case.Portal_ID__c,
""
)
)
)
}