KELL Solutions and KnowledgebaseGeneral Salesforce Resources Helpful Configuration Tips & TricksHow to create a visual warning based on a contact's communication preferences

How to create a visual warning based on a contact's communication preferences

In this article we will demonstrate how to create a visual warning on a contact page layout when certain conditions are met. This can be modified for virtually any condition, but for this example we're using communication preferences, (e.g. do not call, do not email). We'll use a formula field to evaluate the preferences of the contact, and if any of the select preferences are "True" then we'll display a graphic on the page layout.

First, go find an image to use as your visual caution

Download the image to your computer. You may want to resize the image. Here's a free online image editing site you can use: http://pixlr.com/editor/

Now you want to create a new "Document" in Salesforce

Give it a label like "Caution", and make sure you put it in a folder that is accessible by all users and not just yourself. Upload the image from your computer and click save.

Grab the unique ID of this image

Grab the unique ID of this image

Now, copy the 15 character ID of the document you just created. Paste that somewhere you can retrieve easily in a few moments, or simply keep this tab open for use.

Next, create a custom field that is a Formula type field on the object. In this case, the Contact object.

Next, create a custom field that is a Formula type field on the object.  In this case, the Contact object.

Choose the formula return type = Text

Choose the formula return type = Text

Here's the scary part, but don't worry

The formula you're creating is a multi-part "IF this, or this, or this" statement. It looks scary above, but it's really quite simple. It's basically saying, "if this field, or this field, or this field = True, then show this image. Otherwise do nothing".

Here's the exact formula:

IF(DoNotCall=True ||Do_Not_Email__c=True||Do_Not_Mail__c=True||Do_Not_Solicit__c=True||Do_Not_Telemarket__c=true ,IMAGE("/servlet/servlet.FileDownload?file=015i0000001octd","Caution"),"")

Notice the 15 character reference ID underlined. That's the document you created earlier.

The highlighted things are the field names. The || bars are the "or" statements. You can replace the field names with your specific fields, and the document ID reference with your caution file.

Add this new field to your page layout

I chose to place my caution file next to the description so that any notes about this individual will be more visible and not lost on the page.

Now you're done!

When the "Do not __" fields are not checked, the Caution field is empty

Finished!

When one or more of the "Do not __" fields are checked, the Caution image appears.