Category Archives: Salesforce

Query Validation Rules associated with an Object using REST API

/services/data/v39.0/tooling/query?q=Select Id,ValidationName,Active,Description,EntityDefinition.DeveloperName,ErrorDisplayField, ErrorMessage From ValidationRule WHERE EntityDefinition.DeveloperName = 'Account'

Radio Button in Visualforce Page

<apex:page >
    <apex:form >
        <apex:pageBlock >
            <apex:pageBlockSection >
                <apex:pageBlockSectionItem >Gender
                    <apex:selectRadio >
                        <apex:selectOption itemLabel="Male" itemValue="m"/>
                        <apex:selectOption itemLabel="Female" itemValue="f"/>           
                    </apex:selectRadio>     
                </apex:pageBlockSectionItem>
            </apex:pageBlockSection>
        </apex:pageBlock>
    </apex:form>
</apex:page>

Salesforce Apex Design Patterns

  • Singleton: Minimizing object instantiation for improved performance and to mitigate impact of governor limits.
  • Strategy: Defining a family of algorithms, enscapsulating each one and making them interchangeable and selectable at runtime.
  • Decorator: Extending the functionality of an sObject in Apex.
  • Facade: Simplifying the execution of classes with complex interfaces (e.g. web service callouts).
  • Composite: Treating a group of objects in a similar manner to a single instance of that object.
  • Bulk State Transition: Efficiently tracking the change of a field value in a trigger and executing functionality based on this change.