Pages

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

Monday, November 30, 2015

Salesforce Process ISCHANGED function not working with compound address fields

I stumbled upon this issue today and raised a case with salesforce and waiting for a response...
just posting it across for others who might face the same issue...

Scenario:
We created a new process on Account to run on both create & update with a simple criteria formula ISCHANGED([Account].BillingAddress) and added an immediate action to the process to do a update a field on the same account record and activated the process.

Expected:
what's expected is every time we change the billing address on the account, this particular field should get updated with the value from the process.

Actual:
strangely, thou the process gets saved without any error for using the IsChanged function on the compound address field, when we updated a billing address on an account, nothing happens. The debug logs shows the process being run but the action is not getting fired.

Workaround:
I recreated the same criteria + action using traditional Workflow Rule + Field update and it works perfectly fine. The Workflow rule runs on Account object (both create & update) and uses the same Criteria Formula ISCHANGED([Account].BillingAddress) and updates the same field.

Summary: 
Since support for Compound address field in ISCHANGED function is a recent addition, I believe its not enabled across all functionalities. I will update this post once I hear back from the salesforce support. There is no known issue as well for this. The only option for now is to go with the workaround of using Workflow rule + field update.

Update:
After raising a case with salesforce and going thru multiple rounds of discussions, its now considered as a known issue and will be included in one of their future releases (but no ETA yet).

here's the known issue link : https://success.salesforce.com/issues_view?id=a1p30000000ePs6AAE

Wednesday, November 25, 2015

Visualforce Datepicker position when using modal popups

This is a quick post to save sometime for people using modal popups with date fields in a visualforce page..

if the default datepicker that shows up when using apex:inputField for date fields is not rendering properly or if its been displayed behind the popup or in some random position, then don't break your head.. apply the below css in your page and it should work fine..

.datePicker { z-index:1151; position:fixed; }

z-index is to bring the datepicker in front of the popup.. use the number (1151 in this case) higher than the one used for the modal popup..

position:fixed is to align the datepicker next to the input field.

hope this helps and saves time for someone..