The Salesforce Spring ’17 release is now available in all orgs with great additions and feature enhancements. In this blogpost, we uncover four hidden gems.

1. Metadata Driven Lightning Component Development

Lightning Component Bundles come with Design Resources which allow admins to configure the components with data. Data added by the admins can be used by the component for application logic and to display dynamic content on the UI.

Take a look at the component below that does a YouTube search based on the keyword configured by the admin. Notice the Lightning Component uses administrator-configured text to drive business logic and display the keyword on the UI.

Prior to this release, the design attributes were not dynamic as there was no provision to attach an Apex layer. Spring ’17 finally allows the design variables to be driven from Apex for picklist values. A Lightning Component ISV developer can now dynamically populate design variables from custom settings or custom metadata.

Here is a sample code snippet of how one would be able to make the design attributes dynamic via Apex.

<design:component label="Dynamic Picker">
  <design:attribute name="type" label="Type" datasource="apex://PickListUtil"/>
</design:component>

The Apex class code snippet for building dynamic picklists from an object “obj__c” and custom field “fld__c” are below.

global class PickListUtil extends VisualEditor.DynamicPickList{
    
    global override VisualEditor.DataRow getDefaultValue(){
        VisualEditor.DataRow defaultValue = new VisualEditor.DataRow('Featured Group', 'Featured Group');
        return defaultValue;
    }
    
    global override VisualEditor.DynamicPickListRows getValues() {
        VisualEditor.DynamicPickListRows  myValues = new VisualEditor.DynamicPickListRows();
        Schema.DescribeFieldResult fieldResult = obj__c.fld__c.getDescribe();
        List<Schema.PicklistEntry> ple = fieldResult.getPicklistValues();
        for( Schema.PicklistEntry f : ple){
           VisualEditor.DataRow value = new VisualEditor.DataRow(f.getLabel(),f.getValue());
           myValues.addRow(value);
        }       
        return myValues;
    }
}

2. Salesforce Optimizer

Optimizer analyzes a suite of features across Salesforce to determine ways that one can simplify customizations and drive adoption of features. Optimizer analyzes a suite of features across implementation and gives concrete recommendations for improving the Salesforce experience. This is huge for an enterprise. To get a taste of how this works, I played a bit on one of the orgs.

Salesforce Optimizer evaluates the following features:

  • Fields
  • Apex triggers
  • Page layouts
  • Report types
  • Validation rules
  • Workflow rules
  • Sharing rules
  • Administrator permissions

Optimizer is available in the setup menu like any other feature. The admin has to allow the application so that it can read metadata from your org and analyze the metadata.

I was surprised to see a nice report detailing:

  1. Field limits – This tells how many fields have been used and what quota of fields are available for me.
  2. Field usage – This listed fields that are not used by my users or process, indicating I need to do some clean up.
  3. Triggers – Surprised to see if I had more than one trigger on an object, the tool quickly displayed that in the report.
  4. The report displayed the numbers used of record types, validation rules, page layouts, etc. and also indicated the objects that had too many validation rules. Too many validation rules on an object takes longer time during the record save process. The report also showed me the number of inactive validation rules.
  5. Sharing rule limits – Examined by the Optimizer.
  6. Administrator Permissions – Calculates the user to admin ratio of an org.

An sample report page would look like:

Note: I have not tested this tool on larger orgs but it might be a good exercise to try.

3. Lightning Design System Included in Visualforce

This is great for designers who want to use Visualforce to do prototypes with Lightning Design System. A simple markup to add SLDS and reference images from SLDS is below.

<apex:page>
    <apex:slds />
        <img src="{!URLFOR($Asset.SLDS, 'assets/images/avatar1.jpg')}" alt="Contact Avatar" />
</apex:page>

4. Wave Packaging

The Spring ’17 release provides better support for packaging various Wave components. This means that ISV partners can now build and publish Wave templates on the AppExchange. There’s also a pilot program for Apex SDK Wave apps.

Final Thoughts

Spring ’17 added some really cool features, making the platform more flexible to build applications at a faster pace. The best part of the Salesforce platform is that it allows you to focus on creating features while the platform takes care of the infrastructure. At CodeScience, our core strength has been building ISV apps and bringing products to market faster. If you need help bringing your app on the AppExchange, let’s talk.