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
Philip KitzmannPhilip Kitzmann 

Show Image if specific Text on another field is given

Hi,
i need some help, i have a Field that is fileld if the contact gets an experience cloud account (contact have user profil).

The field is filled with the User Profil Name. Now i want a nother field that show a specific image compare to the user profil that is writen in the User Profil Field.

This formula work:
IF(CONTAINS(User_Profil__c, "abc"), IMAGE("/resource/111/abc", "abc"),
IMAGE("/resource/999/error", "error"))

But if i try to expand the forumla with more possible porfile names i get an formula error.

IF(CONTAINS(User_Profil__c, "abc"), IMAGE("/resource/111/abc", "abc"),
IF(OR(CONTAINS(User_Profil__c, "XXX"), IMAGE("resource/000/xxx", "XXX"),
IMAGE("/resource/999/error", "error"))))

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

So how can i create a formula that show a specific image if the User_Profil__C Field is filled with a specific Text?
Best Answer chosen by Philip Kitzmann
Philip KitzmannPhilip Kitzmann
Ok i figured out alone.

IF(CONTAINS(User_Profil__c, "111"), IMAGE("/resource/111/111", "111"),
IF(CONTAINS(User_Profil__c, "222"), IMAGE("resource/222/222", "222"),
IF(CONTAINS(User_Profil__c, ""), IMAGE("/resource/000/000", "none"),NULL)))

This formula work and can be epxand if more experience clouds or partner portals are going online with a specific icon shown.

All Answers

AshwiniAshwini (Salesforce Developers) 
Hi Philip,
Can you try something like below:
IF(
    TEXT(User_Profil__c) = "abc", IMAGE("/resource/111/abc", "abc"),
    IF(
        TEXT(User_Profil__c) = "XXX", IMAGE("/resource/000/xxx", "XXX"),
        IMAGE("/resource/999/error", "error")
    )
)

Related:https://help.salesforce.com/s/articleView?id=sf.customize_functions_text.htm&type=5 (https://help.salesforce.com/s/articleView?id=sf.customize_functions_text.htm&type=5
https://help.salesforce.com/s/articleView?id=000385501&type=1 (https://help.salesforce.com/s/articleView?id=000385501&type=1
https://www.youtube.com/watch?v=rJQOs2HWU68 
https://help.salesforce.com/s/articleView?id=sf.useful_advanced_formulas_image_links.htm&type=5 (https://help.salesforce.com/s/articleView?id=sf.useful_advanced_formulas_image_links.htm&type=5

If this information helps, please mark the answer as best. Thank you​​​​​​​
Philip KitzmannPhilip Kitzmann

Hi Ashwini,

this dont work :( 
"Error: Incorrect parameter type for function 'TEXT()'. Expected Number, Date, DateTime, Picklist, received Text"

The Field where i insert the formula is a formula field "text" and the Field "User_Profil" is Text field with a formula the insert the profile name if the contact get access to experience cloud or partner community.

So "TEXT" doesnt work and i thought i can get this with "CONTAINS".

We want to expand the formula later when we get more than one experience cloud portals.
Atm it only work with none or one name but not if i want to insert more different text than can be shown in the User_Profil Field.

Philip KitzmannPhilip Kitzmann
Ok i figured out alone.

IF(CONTAINS(User_Profil__c, "111"), IMAGE("/resource/111/111", "111"),
IF(CONTAINS(User_Profil__c, "222"), IMAGE("resource/222/222", "222"),
IF(CONTAINS(User_Profil__c, ""), IMAGE("/resource/000/000", "none"),NULL)))

This formula work and can be epxand if more experience clouds or partner portals are going online with a specific icon shown.
This was selected as the best answer