Coding techniques that keep your
admins happy
Writing configurable code in Salesforce
Roy Gilad, Israel Salesforce DUG, Leader
Conduit Mobile, CRM Solutions Manager
@RoyGilad
Roy Gilad
Israel Salesforce DUG Leader
CRM Solution Manager, Conduit Mobile
@RoyGilad
All about Conduit Mobile
Award-winning, DIY app-creation platform, providing
publishers with a one-stop shop for engaging users on the
go and growing their business on mobile
 One-click creation of custom-branded mobile apps and sites
 Over 160,000 apps created; more than 1,000 new apps each day
 Specialized features for different business verticals: small
businesses, restaurants, events, education, and more
 End-to-end solution: app creation, submission to app marketplaces,
promotional tools, content management, and advanced analytics
Coding techniques that keep your admins happy

What is this session
about?
DRY principle
Don’t Repeat Yourself:

“Every piece of knowledge must have a single, unambiguous,
authoritative representation within a system”
Coding techniques that keep your admins happy
In this presentation we will cover:

Custom Labels

Field Sets

Custom Settings
Custom Labels
Custom Labels
What is it?
 Custom labels are custom text values that can be accessed from
anywhere:
 Apex classes
 Visualforce pages
 Formulas
 Validation rules
Custom Labels
Why should we use it?
 Text to be maintained by a system administrators.

 DRY: Reuse and consistency throughout the organization.
 Code readability.
 Multi-lingual support.
Custom Labels
Where can we find them?
 Setup-> Build -> Create -> Custom Labels
Custom Labels
Demo
Custom Labels
Where should we use it?
 Text in pages

 Error messages in triggers
 When you have multi-lingual org – A MUST!
 Place-holder for repeated string in your code.
Custom Labels
How to use them?
 Apex:

 System.Label.Label_name
 Visualforce:

 {!$Label. Label_name}
 Formula and validations:
 $Label. Label_name
Field Sets
Field Sets
What is it?
 Set of fields in an object that can be used dynamically in
Apex and in Visualforce pages.

 Field sets are a powerful tool when you have a number of
fields used in the same operation, or in the same context.
Field Sets
Why should we use it?
 Pages and integrations can be controlled by a system administrators.

 DRY: Reuse and consistency throughout the organization.
 Code readability.
Field Sets
Where can we find them?
 Can be defined for any object:
• In standard objects it can be found under the object name:
• In custom objects it can be found as a related list in the object:
Field Sets
Demo
Field Sets
Where should we use them?
 Visualforce pages and controllers.

 Fields that are sometimes presented and updated together.
Field Sets
How to use them?
 Visualforce pages:
• {!$ObjectType.Account.FieldSets.FieldSetName}

 Apex:
• SObjectType.Account.FieldSets. FieldSetName.getFields()
Custom Settings
Custom Settings
What is it?
 Similar to custom objects.

 Enable developers to create custom sets of data.
 Enable to create and associate custom data for an
organization, profile, or specific user.
Custom Settings
Why should we use it?
 Access dictionary tables without querying.

 Can provide Profile-specific and User-specific tables.
Custom Settings
Where can we find them?
 Setup -> Build -> Develop -> Custom Settings
Custom Settings
Demo
Custom Settings
Demo
Custom Settings
Demo
Custom Settings
How do I use them?
 Apex

 List Custom Setting:

 Hierarchy:
 CustomSettingsName__c.getInstance(UserId 
ProfileId);
Summary
In this presentation we covered:

Custom Labels

Field Sets

Custom Settings
Roy Gilad
Israel DUG Leader,
@RoyGilad
Code is available for download at:
https://gist.github.com/RoyGilad
Presentation is available at:

http://www.slideshare.net/RoyGilad/salesforce-codingtechniques-that-keep-your-admins-happy-df13
Salesforce Coding techniques that keep your admins happy (DF13)

Salesforce Coding techniques that keep your admins happy (DF13)

  • 1.
    Coding techniques thatkeep your admins happy Writing configurable code in Salesforce Roy Gilad, Israel Salesforce DUG, Leader Conduit Mobile, CRM Solutions Manager @RoyGilad
  • 2.
    Roy Gilad Israel SalesforceDUG Leader CRM Solution Manager, Conduit Mobile @RoyGilad
  • 3.
    All about ConduitMobile Award-winning, DIY app-creation platform, providing publishers with a one-stop shop for engaging users on the go and growing their business on mobile  One-click creation of custom-branded mobile apps and sites  Over 160,000 apps created; more than 1,000 new apps each day  Specialized features for different business verticals: small businesses, restaurants, events, education, and more  End-to-end solution: app creation, submission to app marketplaces, promotional tools, content management, and advanced analytics
  • 4.
    Coding techniques thatkeep your admins happy What is this session about?
  • 5.
    DRY principle Don’t RepeatYourself: “Every piece of knowledge must have a single, unambiguous, authoritative representation within a system”
  • 6.
    Coding techniques thatkeep your admins happy In this presentation we will cover: Custom Labels Field Sets Custom Settings
  • 7.
  • 8.
    Custom Labels What isit?  Custom labels are custom text values that can be accessed from anywhere:  Apex classes  Visualforce pages  Formulas  Validation rules
  • 9.
    Custom Labels Why shouldwe use it?  Text to be maintained by a system administrators.  DRY: Reuse and consistency throughout the organization.  Code readability.  Multi-lingual support.
  • 10.
    Custom Labels Where canwe find them?  Setup-> Build -> Create -> Custom Labels
  • 11.
  • 12.
    Custom Labels Where shouldwe use it?  Text in pages  Error messages in triggers  When you have multi-lingual org – A MUST!  Place-holder for repeated string in your code.
  • 13.
    Custom Labels How touse them?  Apex:  System.Label.Label_name  Visualforce:  {!$Label. Label_name}  Formula and validations:  $Label. Label_name
  • 14.
  • 15.
    Field Sets What isit?  Set of fields in an object that can be used dynamically in Apex and in Visualforce pages.  Field sets are a powerful tool when you have a number of fields used in the same operation, or in the same context.
  • 16.
    Field Sets Why shouldwe use it?  Pages and integrations can be controlled by a system administrators.  DRY: Reuse and consistency throughout the organization.  Code readability.
  • 17.
    Field Sets Where canwe find them?  Can be defined for any object: • In standard objects it can be found under the object name: • In custom objects it can be found as a related list in the object:
  • 18.
  • 19.
    Field Sets Where shouldwe use them?  Visualforce pages and controllers.  Fields that are sometimes presented and updated together.
  • 20.
    Field Sets How touse them?  Visualforce pages: • {!$ObjectType.Account.FieldSets.FieldSetName}  Apex: • SObjectType.Account.FieldSets. FieldSetName.getFields()
  • 21.
  • 22.
    Custom Settings What isit?  Similar to custom objects.  Enable developers to create custom sets of data.  Enable to create and associate custom data for an organization, profile, or specific user.
  • 23.
    Custom Settings Why shouldwe use it?  Access dictionary tables without querying.  Can provide Profile-specific and User-specific tables.
  • 24.
    Custom Settings Where canwe find them?  Setup -> Build -> Develop -> Custom Settings
  • 25.
  • 26.
  • 27.
  • 28.
    Custom Settings How doI use them?  Apex  List Custom Setting:  Hierarchy:  CustomSettingsName__c.getInstance(UserId ProfileId);
  • 29.
    Summary In this presentationwe covered: Custom Labels Field Sets Custom Settings
  • 30.
    Roy Gilad Israel DUGLeader, @RoyGilad
  • 31.
    Code is availablefor download at: https://gist.github.com/RoyGilad Presentation is available at: http://www.slideshare.net/RoyGilad/salesforce-codingtechniques-that-keep-your-admins-happy-df13