Build an S-control

S-Controls

Note: S-controls have been superseded by Visualforce pages. For more information, please visit S-Control_Deprecation


If you have spent much time hanging around developer.force.com, or using the Force.com platform, you have probably heard of something called an s-control. An s-control is a way to extend the functionality of your Force.com application by combining client-side code with your app. While they can still be useful in some contexts, its useful to note that Visualforce Pages largely supersede s-controls, so its important to understand that technology before embarking on a new s-control project.

You define an s-control in the Force.com Application Framework, and then add standard HTML tags and client-side code to create the s-control. When your application accesses the s-control, the s-control runs on the client, but it can interact with data in the Force.com database through the Web Services API.

An s-control can include a user interface, in which case it can be included as part of a standard Force.com page, or as the entire page itself. You can also create s-controls that only contain code, or s-control snippets that can be re-used in other s-controls.

You can use the following resources to help you get started on building s-controls -

  • This presentation gives you a good place to start understanding and implementing s-controls.
  • This article gives you code for a simple 'Hello World' s-control, built with the AJAX toolkit.
  • This article gives you an explanation and the code to build a more robust s-control which uses Adobe Flex to create a rich user interface.

And the on-line help also includes several code examples and tips on developing s-controls.

Other Resources

Demystifying S-Controls and AJAX: Learn what S-controls are and how to build them using AJAX.

Code Samples

Basic s-control: Standard 'Hello World' s-control.

S-control title snippet: S-control that calls another s-control snippet.

S-control snippet: Snippet called by above example.

Using SOSL in an s-control

Implementing Salesforce.com look and feel in an s-control

Sending data to a mobile phone from an s-control

Accessing a Web service from an s-control

The Web service called by the previous example.

S-Controls and AJAX: Showing a pull-down list of related contacts