Total Pageviews

Tuesday, September 10, 2013

SFDC quick heals ( 18-15 SFDC ID , Activating inactive stage picklist value, etc...)

Every now and then we stumble  upon small nagging issues which we research and resolve but few years down the line re-encounter them and proceed to reinvent the wheel.
One such trifling issue is that of the nagging 15 digit vs 18 digit id of salesforce (record id).

In salesforce each record Id represents a unique record within an organisation. 
These ids are in two formats /type /version for every record Id in salesforce :
  1. 15 digit case-sensitive version which is referenced in the UI (Detail pages / reports)
  2. 18 digit case-insensitive version which is referenced through the API
What do these 15 digit and 18 digit ids stand for:-
The last 3 digits of the 18 digit ID are a checksum of the capitalizations of the first 15 characters, this ID length was created as a workaround to legacy systems which were not compatible with case-sensitive IDs.
The API accepts the 15 digit ID as input but will always return the 18 digit ID.


How to get the 18 digit id in the UI?
One may write code to decipher the 18 digit id from the 15 digit id but an easier way out is to generate the 18 digit counterpart in a formula field by use of caseinsensitiveid() function.


Activating inactive/ re-activating picklist values in "Stage" field of Opportunity 

Activating the inactive picklist values of "Stage" field in Opportunity is bit cumbersome. Let me explain with an example. Lets assume I have an active stage called "stage1". Several opportunities are still assigned to "stage1" and one has to delete (de-activate it). One now has a "stage1" that cannot be reactivated. If one wants to "re-activate" it, one has to create a new stage with the same percent and other properties as the inactive "stage1". Then, one would delete the inactive "stage1" and, during this process, system will ask/prompt user to replace any opportunities that are associated with "stage1" with another stage. At that time one has to select "stage2". Now the "stage1" is deleted and all the previous "stage1" opportunities are now aligned to  "stage2".

Now one has to recreate the "stage1" as an active stage. The final step is to delete "stage2" and when prompted replace it with "stage1". "Stage2" will be deleted and stage1 will now will be active again.