Displaying HTML of formula field in Salesforce on Search form

created

If you have a formula field of type Text in a Salesforce object that you are displaying on the List Display or Record Display view of a Directories page, HTML can be included in the formula field which will be rendered by Soapbox. Salesforce variables, conditional logic, and operators can be included in the formula field to influence the HTML rendered by Soapbox.

Styling included in HTML will reference Soapbox template when rendered

Any typography included in the HTML will reference the template for your site once rendered by Soapbox. As a simple example, including an H3 tag to give a heading style to text within the formula field will cause this text to match any text with the H3 tag applied in, say, an article on your site.

Using Soapbox Shortcodes within formula field

Soapbox Shortcodes is a tool that allows our team to create code elements that make it simpler for you to add more complex or customized elements to an article or module that are editor-safe. These same Soapbox Shortcodes can be used in a Salesforce formula field and will be rendered by Soapbox just as if they were in an article.

Example: Embedding a video using YouTube's code

The following is an example of a formula field that checks to see if a field in the Salesforce object is populated and, if it is, it inserts that field value into YouTube embed code. Notice that the entire block of HTML text needs to be included in quotes with any quotes contained with the HTML code - like for the attributes of the iframe tag - need to be single quoted:

IF(Video__c = "","", "
<h3>This is an embedded video:</h3>
<iframe src='" & Video__c & "' width='425' 
height='350' frameborder='0'></iframe>")

Example: Embedding a video using a Soapbox Shortcode

The following produces the same result but uses a Soapbox Shortcode our team created that does the work of including YouTube's embed code:

IF(Video__c = "","", "
<h3>This is an embedded video:</h3>
[videocode]" & Video__c & "[/videocode]") 

Result of example

Both examples display in Soapbox as shown between the line breaks, if the field value in the Contact object is http://www.youtube.com/watch?v=mpaPBCBjSVc:

----------------------------------------

This is the embedded video:

----------------------------------------

Interested in having us add a Soapbox Shortcode to your site? Any questions about this whole thing? Contact us!

Have more questions? Submit a request
Article is closed for comments.