Monday, January 11, 2016

Salesforce Global / Universal Picklist - Its Finally arrived..

With Spring 16 release, we are getting the long requested Global / Universal picklist feature..

Note it's still in Beta phase and hopefully will become GA in next release..

So How to create a global picklist and use it, here's a quick intro

1. Go to Setup -> Create , you will see the new Picklists menu item

2. Click the Picklists and you will have option to enter a label and api name, just like you create a normal picklist field. Enter a label and name and go to the next screen

3. you will have a large text area to enter the picklist values. Enter the picklist values and save it

4. Now if you go to create a new custom picklist field, you will have an option to either select the values from a global picklist and enter your own values.

5. Give your new picklist a label and name, and choose the global picklist you created before as the source for values and you are done. 

Thursday, January 07, 2016

Salesforce Custom Metadata Types

Its been a while since Salesforce introduced the Custom Metadata Type feature..

if you are wondering how you can make use of this, here's a use case which I recently worked with.

Store all your integration settings in one place, Yes in a single Custom Metadata instead of multiple Custom Settings

Create a custom metadata type called Integration Settings. Include Fields to identify which external system it is, which environment, and the other additional connection details like the endpoint url, username, password, timeout etc..

Create a Utility class method in Apex which takes the external system name we want to connect to as a parameter, and then identifies the current salesforce environment (say production or sandbox using the Organization details ) and returns the connection details for that system in that environment.

With this, we don't need to ever worry about missing integration details during deployments or having incorrect urls in different environments due to sandbox refresh or migration custom settings data between environments or manually creating configuration details.

Salesforce Identify Current Users UI mode theme : Classic or Lightning Experience or Salesforce1 mobile

Now with Spring 16 release, Developers and Admins can easily identify the current user's Salesforce user interface mode or theme - i.e if the running user is using Salesforce Classic UI or the new Lightning Experience in desktop or if the user is in Salesforce1 mobile.

We now have new set of values included in the existing User Context Global variables (both $User in workflows/validations/visualforce/formulas and also to the UserInfo class in Apex)

with this, we can simply call either UserInfo.getUiTheme( ) method or $User.UiTheme variable to identify the running user's UI mode.

here's the list of UI Themes returned by this global variable
  • Theme1—Obsolete Salesforce theme
  • Theme2Salesforce Classic 2005 user interface theme
  • Theme3Salesforce Classic 2010 user interface theme
  • Theme4d—Modern “Lightning Experience” Salesforce theme
  • Theme4tSalesforce1 mobile Salesforce theme
  • PortalDefaultSalesforce Customer Portal theme
  • WebstoreSalesforce AppExchange theme

Reference :
You will find this cool feature documented (buried) deep inside the Spring 16 release notes