Do you want to spend more time developing new and exciting features, and less time maintaining existing code when a field is added or an error message needs to change? Then keep yourself and your Administrator happy by coding to anticipate these changes using Custom Settings, Field Sets, and Labels.
Source code is available at:
https://gist.github.com/RoyGilad
This presentation was presented by Roy Gilad at Dreamforce 2013
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Salesforce Coding techniques that keep your admins happy (DF13)
1. Coding techniques that keep your
admins happy
Writing configurable code in Salesforce
Roy Gilad, Israel Salesforce DUG, Leader
Conduit Mobile, CRM Solutions Manager
@RoyGilad
3. 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
8. Custom Labels
What is it?
Custom labels are custom text values that can be accessed from
anywhere:
Apex classes
Visualforce pages
Formulas
Validation rules
9. 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.
12. 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.
13. Custom Labels
How to use them?
Apex:
System.Label.Label_name
Visualforce:
{!$Label. Label_name}
Formula and validations:
$Label. Label_name
15. 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.
16. 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.
17. 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:
19. Field Sets
Where should we use them?
Visualforce pages and controllers.
Fields that are sometimes presented and updated together.
20. Field Sets
How to use them?
Visualforce pages:
• {!$ObjectType.Account.FieldSets.FieldSetName}
Apex:
• SObjectType.Account.FieldSets. FieldSetName.getFields()
22. 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.
23. Custom Settings
Why should we use it?
Access dictionary tables without querying.
Can provide Profile-specific and User-specific tables.
31. 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