Loading
Salesforce Enforces New Security Requirements in Summer 2026Read More
Extend Salesforce with Clicks, Not Code
INCLUDE

INCLUDE

Returns content from an s-control snippet. Use this function to reuse common code in many s-controls.

Use

{!INCLUDE(source, [inputs])} and replace source with the s-control snippet you want to reference. Replace inputs with any information you need to pass the snippet.

Tips

  • Because this function references an s-control snippet and does not copy it, it always runs the latest content of the s-control snippet. Remember that changing your s-control snippet affects all INCLUDE functions that refer to it.
  • Use the $Request global variable to access any information inside the snippet.
  • This function is only available in custom buttons, links, and s-controls.
S-Control Example: Include a Header Snippet
S-Control Example: Include a Header Snippet
<html>
    <body>
        {!INCLUDE(
            $SControl.Header_Snippet, 
            [title = "My Title", theme = "modern"]
         )}
    </body>
</html>

This example references a snippet that provides a header for a page that you created to display in a web tab. It displays the page title “My Title.” Use the $SControl global variable to reference a custom s-control.

S-Control Example: Include Input Parameters
S-Control Example: Include Input Parameters

Use the following two examples to see how you can create a reusable snippet and include it in an s-control.

<h2 class="{!$Request.titleTheme}.title">
    {!$Request.titleText}
</h2>

This snippet requires two input parameters: titleTheme and titleText. It is a reusable HTML tag that presents a page title and theme based on input parameters. Next, create an s-control that includes this snippet:

<html>
    <head/>
    <body> 
        {!INCLUDE(
                $SControl.Title_Snippet, 
                [titleTheme = "modern", titleText = "My Sample Title"]
        )}
        Insert your page-specific content here ... 
    </body> 
</html>

This s-control uses the snippet titled Title_Snippet to display the title of the page “My Sample Title” and modern theme. Replace Insert your page specific content here with your own HTML content and use the s-control as the source of a web tab to create your own pages in Salesforce.

 
Loading
Salesforce Help | Article