coding techniques that keep your admins happy
DESCRIPTION
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. Join us as we show examples of these techniques and how they allow you to code so that your features can be easily configured.TRANSCRIPT
![Page 1: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/1.jpg)
Coding techniques that keep your
admins happy
Writing configurable code in Salesforce
Roy Gilad, Israel Salesforce DUG, Leader
Conduit Mobile, CRM Solutions Manager
@RoyGilad
![Page 2: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/2.jpg)
Roy Gilad
Israel Salesforce DUG Leader
CRM Solution Manager, Conduit Mobile
@RoyGilad
![Page 3: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/3.jpg)
Coding techniques that keep your admins happy
What is this session
about?
![Page 4: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/4.jpg)
DRY principle
Don’t Repeat Yourself:
“Every piece of knowledge must have a single, unambiguous,
authoritative representation within a system”
![Page 5: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/5.jpg)
Coding techniques that keep your admins happy
In this presentation we will cover:
Custom Labels Field Sets Custom Settings
![Page 6: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/6.jpg)
Custom Labels
![Page 7: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/7.jpg)
Custom Labels
What is it?
Custom labels are custom text values that can be accessed from
anywhere:
Apex classes
Visualforce pages
Formulas
Validation rules
![Page 8: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/8.jpg)
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.
![Page 9: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/9.jpg)
Custom Labels
Where can we find them?
Setup-> Build -> Create -> Custom Labels
![Page 10: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/10.jpg)
Custom Labels
Demo
![Page 11: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/11.jpg)
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.
![Page 12: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/12.jpg)
Custom Labels
How to use them?
Apex:
System.Label.Label_name
Visualforce:
{!$Label. Label_name}
Formula and validations:
$Label. Label_name
![Page 13: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/13.jpg)
Field Sets
![Page 14: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/14.jpg)
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.
![Page 15: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/15.jpg)
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.
![Page 16: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/16.jpg)
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:
![Page 17: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/17.jpg)
Field Sets
Demo
![Page 18: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/18.jpg)
Field Sets
Where should we use them?
Visualforce pages and controllers.
Fields that are sometimes presented and updated together.
![Page 19: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/19.jpg)
Field Sets
How to use them?
Visualforce pages:
• {!$ObjectType.Account.FieldSets.FieldSetName}
Apex:
• SObjectType.Account.FieldSets. FieldSetName.getFields()
![Page 20: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/20.jpg)
Custom Settings
![Page 21: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/21.jpg)
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.
![Page 22: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/22.jpg)
Custom Settings
Why should we use it?
Access dictionary tables without querying.
Can provide Profile-specific and User-specific tables.
![Page 23: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/23.jpg)
Custom Settings
Where can we find them?
Setup -> Build -> Develop -> Custom Settings
![Page 24: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/24.jpg)
Custom Settings
Demo
![Page 25: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/25.jpg)
Custom Settings
Demo
![Page 26: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/26.jpg)
Custom Settings
Demo
![Page 27: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/27.jpg)
Custom Settings
How do I use them?
Apex
List Custom Setting:
Hierarchy:
CustomSettingsName__c.getInstance(UserId \
ProfileId);
![Page 28: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/28.jpg)
Summary
In this presentation we covered:
Custom Labels Field Sets Custom Settings
![Page 29: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/29.jpg)
Roy Gilad
Israel DUG Leader,
@RoyGilad
![Page 30: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/30.jpg)
Code is available for download at:
https://gist.github.com/RoyGilad
Presentation is available at:
http://www.slideshare.net/RoyGilad/salesforce-coding-
techniques-that-keep-your-admins-happy-df13
![Page 31: Coding Techniques That Keep Your Admins Happy](https://reader034.vdocument.in/reader034/viewer/2022042714/5563bc0ad8b42ad83c8b4e0d/html5/thumbnails/31.jpg)