Salesforce Object ID Prefixes Decoder (Your secret decoder ring for Salesforce IDs)

In the blog post “What is difference between 15 and 18 Digit Record Id’s in Salesforce” http://salesforcegenius.com/difference-15-18-digit-record-ids-salesforce/ I make reference to a Salesforce Acccount Id of 0015000001Fn4VL in my sample.

These IDs are the core to identifying the unique records and configuration in Salesforce. This information can be found in Knowledge Article Number 000005995.  I would like to share with my awesome admins the ID Prefix and the Objects those IDs are associated to. This can help you if you work in a multiple administrator org and someone provided to you and already exported file from the system.

Open the box and grab your Salesforce decoder ring to take the mystery out of those ID Prefix.

ID Prefix

Object Type

001 Account
002 Note
003 Contact
005 User
006 Opportunity
008 OpportunityHistory
100 UserLicense
101 Custom Label
400 ApexClassMember
500 Case
501 Solution
608 ForecastShare
701 Campaign
707 AsyncApexJob
709 ApexTestQueueItem
750 Bulk Query Job
751 Bulk Query Batch
752 Bulk Query Result
800 Contract
806 Approval
888 Remote Access
000 Empty Key
00a CaseComment/IdeaComment
00b WebLink
00B View
00D Organization
00e Profile
00E UserRole
00G Group
00h Page Layout
00I Partner
00J OpportunityCompetitor
00K OpportunityContactRole
00k OpportunityLineItem
00l Folder
00N Custom Field Definition
00o OpportunityLineItemSchedule
00O Report
00P Attachment
00p UserTeamMember
00Q Lead
00q OpportunityTeamMember
00r AccountShare
00S Import Queue
00t OpportunityShare
00T Task
00U Event
00v CampaignMember
00X EmailTemplate
010 CaseSolution
011 GroupMember
012 RecordType
015 Document
016 BrandTemplate(Letterhead)
018 EmailStatus
019 BusinessProcess
01a DashboardComponent
01D UserAccountTeamMember
01H MailmergeTemplate
01I Custom Object
01m BusinessHours
01M AccountTeamMember
01n CaseShare
01N Scontrol
01o LeadShare
01p ApexClass
01q ApexTrigger
01Q AssignmentRule
01Q Workflow Rule
01r Visualforce Tab
01s Pricebook2
01t Product2
01u PricebookEntry
01Y CampaignMemberStatus
01Z Dashboard
020 EventAttendee
021 QuantityForecast
022 FiscalYearSettings
026 Period
027 RevenueForecast
028 OpportunityOverride
029 LineitemOverride
02a ContractContactRole
02c Sharing Rule
02i Asset
02n CategoryNode
02o CategoryData
02s EmailMessage
02Z AccountContactRole
033 Package
035 SelfServiceUser
03d Validation Rule
03g QueueSobject
03j CaseContactRole
03s ContactShare
03u UserPreference
04g ProcessInstance
04h ProcessInstanceStep
04i ProcessInstanceWorkitem
04k Outbound Message Id
04l Outbound Notification Id
04m AdditionalNumber
04s AsyncResult/DeployResult
04t Install Package
04v CallCenter
04W RevenueForecastHistory
04X QuantityForecastHistory
04Y Field Update
058 ContentWorkspace
059 ContentWorkspaceDoc
05X DocumentAttachmentMap
060 Portal Id
066 ApexPage
068 ContentVersion
069 ContentDocument
07E Sandbox
07L ApexLog
07M ApexTestResult
07M Apex Test Result
081 StaticResource
082 Data from Uninstalled Packages
083 Vote
087 Idea
08e CronTrigger
08s CampaignShare
091 EmailServicesFunction
092 Weekly Data Export
093 EmailServicesAddress
099 ApexComponent
09a Community
0A2 Change Set
0A3 Installed Package
0BM Connection – Salesforce to Salesforce
0C0 Holiday
0D2 OrgWideEmailAddress
0D5 UserProfileFeed
0D5 FeedItem/NewsFeed/UserProfileFeed
0DM Site
0E8 EntitySubscription
0EP Inbound Change Set
0J0 SetupEntityAccess
0PS Permission Set Metadata
0Q0 Quote
0t0 TagDefinition
0Ya LoginHistory
1dc MetadataContainer
1dr ContainerAsyncRequest
7tf TraceFlag

What is difference between 15 and 18 Digit Record Id’s in Salesforce?

Many time during my mentoring sessions I get asked by new administrators and developers this question. “What is the difference between a 15 digit id and 18 digit id in Salesforce?”

Normally, when a Salesforce user pulls the id from a record through the interface on any object they get the 15 digit id by design.  So, if you created a report on Leads / Account / Contacts or any custom object and add the id field through the interface it will look something like 0015000001Fn4VL.

However, if you were to access that same Salesforce account id via an API or a tool like this from the Apex Dataloader & workbench 0015000001Fn4VLAAZ.

One thing to note is that Salesforce IDs are case sensitive when they are 15 digit and insensitive when they are 18 digit.  This means you must take into account upper and lower cases when you export the data from the system for the case sensitive data elements.  If your using tools like vlookup in Excel to do comparison from various sources of data, be careful as Excel can incorrectly map the data since it is not case sensitive on the 15 digit id.

The last three digits in the ID is a checksum.  A calculation to assure that the first 15 pieces of the ID are accurate for the object its being written into.

So following that analogy just mentioned.

15 digit case-sensitive version

15 digit ID is what will be received from within the user interface

18 digit case-insensitive and best used for manipulating data outside Salesforce

18 digit id is referenced through in the API and other 3rd party tools.

If you would like to convert the current user interface id to 18 digits this can be done by using a formula very simple formula.  I have seen a couple of versions of the formula but this is the one that worked best for me in my career.

All you need to do is add a new formula field, text 18 characters with “CASESAFEID(ID)”

Salesforce has a knowledge base article on this topic which gives clear instructions on how to use it.

Convert a 15 character ID to a 18 character ID

Salesforce

Knowledge Article Number

000005288
Description Convert 15 character IDs to 18 character IDs to update records,

or to make working in systems that aren’t case sensitive easier.

Resolution Follow the steps below to create a formula field that will give you

the 18 characters ID of the records.

1. Go to Setup | Customize | object name | click Fields
– For Custom objects: Setup Create Objects | object name
3. In the related list “Custom Fields & Relationships” click New.
4. Click the Formula radio button.
5. Click the Text radio button for “Formula Return Type.”
6. Input the following Formula into the Formula Editor:

CASESAFEID(Id)

7. Set Field Visibility, add/ remove from Page Layout(s).
8. Click Save.

So when your boss asks you to do that dataload of leads / Accounts / Contacts or Opportunities rise up and take the challenge.  Using the formula will help you access the 18 digit Id so you can successfully cleanse the data outside the system and push it back up after the business has fixed the incorrect data elements.

Process Builder: Created and Last Modified Date information

Many companies are seeing the strength of using Process Builder for automating the company business process.  As an admin who used Salesforce for almost a decade, I am very versatile in the use of both Workflows and Process Builder. I must honestly say, the strength of Process Builders cross object functionality is very impressive and being used more by our organization to meet tasks previously performed by Workbench in our Sprints.

As one of the admins or developers for your org, you may have the need to find out who created or last modified one of the process builder that were previously built.  This is especially important if your have multiple administrators and developers working in your org.  However, for some reason the created and last modified username and last modified date does not show up on the admin user interface. Hopefully, sometime soon Salesforce will make this available in the admin UI as its essential for auditing purposes and helpful for someone investigating a recent change.

If you have a Process Builder automated process that you need to identify who created or last modified it, this can be accomplished pretty quickly with the use of the Workbench.

Login to the Workbench by doing one of the two following steps.

a. Google search of the “Salesforce Workbench” to get the latest version of the Workbench

b. Use the following url https://workbench.developerforce.com/

Once you logged into the workbench with your username and password credentials, you want to do the following to get the created by and last modified by administrator information.

  1. Click on the “Info” drop down.
  2. Hover over : “Metadata Types & Components”
  3. Click on “Metadata Type & Components” in the available list
  4. Pick “Flow“ in the drop down when you see Metadata Type & Components in blue.
  5. Click on Components “folder” for list of Process Builders. I will display components.
  6. Click on the Process Builder name you used in your Salesforce Org to find the details.  Mine was Chatter Post on New Contact.

Picture from steps 1 (info) & 2 (Metadata Types & Components)

Picture from steps 3 (flow) / 4 (folder) & 5 (your process builder)

Now you know who created the process builder or modified that working process builder job.  This can be very valuable information for many different reasons.

How to easily identify a Salesforce workflow that sent that automated email to an Admin, Developer or User. 

Many times throughout my career I would have a user send an email or a string of automated emails to my support team and say “John Jones is a new hire” and I would like him to get a copy of this automated email.  Regardless if it’s a part of your Sales or Service automation process, us admins dive into the back-end system to figure out where the automated email came from and add John to the list of the workflow recipients.  Not a terrible process and effective at the end of the day.

However, what if I told you there was an easy way to figure it out without searching through all those workflows manually in your Salesforce Org?

You know, that custom view you have in either your Leads, Opportunities or Cases with the word “Active” in it.  The one you have to click more at the bottom since you have so many workflows.

Its pretty easy.  Just follow the below instructions.

If you or your company is using Outlook – Go to the automated email and do the following.

  1. Click on “File

  1. Click on “Properties

  1. Go to the Internet Headers section in Properties.

In the Internet headers you will find all sorts of valuable information like the Org Id (SFDC-LK), the user SFDC-User) who caused the condition which fired the email.

Even the id of the workflow.  01W31000000….. is the id of the workflows that fired this alert!  So you can easily just add John Jones as quickly and productively as possible.

 

If you or your company is using Gmail – Go to the automated email and do the following.

  1. Click on the “Down Arrow” on the right side of the reply button.

  1. Click on “Show Original

Similar to the Internet headers you will find all sorts of valuable information like the Org Id (SFDC-LK), the user SFDC-User) who caused the condition which fired the email.

You will find the id of the workflow.  01W31000000….. that fired this alert!  So you can easily just add John Jones as quickly and productively as possible.

I really cant tell you how much time I had invested sifting through the workflows before I found out about this information.  Don’t get me wrong its good to know your companies workflows inside and out.

So every minute you invest in investigating your workflows makes you a more awesome admin.  Shortcuts like these make you a super admin.

Updating Hard-Coded References in your Salesforce Org

At times administrators and developers think it’s a good idea to hard code salesforce instances into their code, email templates or other parts of the application. I have went through three production refreshes in my career which were all impacted by this behavior. The hyperlink in an email template will look something like https://na22.salesforce.com/id.

Salesforce Knowledge Article Number 000230820 Updating Hard-Coded References explains what hard coded references are and how to find them in your org.

https://help.salesforce.com/articleView?id=Updating-Hard-Coded-References-FAQ&type=1

Quoted right from the Salesforce Article 000230820.
“3. How can I update hard-coded references using Force.com IDE?
Follow the steps below to update hard-coded references* in your org and your org’s metadata (setup or customer code):

i. Create a new Force.com Project:
1. Go to File > New > Force.com Project
2. Provide a name for your project, enter your login credentials for the org, and then click “Next.”

ii. Choose the project contents:
1. Select metadata components, then click “Choose.”
2. On the next screen for metadata components, select the field’s required then click “OK.”

a. At a minimum, we suggest selecting the following: email templates, home page components, web links, workflow, triggers, classes, visualforce pages, and tabs.

3. Please keep in mind that you can only pull 1500 components at a time. If you need to pull more metadata, we recommend dividing your work into multiple projects.
a. If you exceed the limit for number of components, you will receive this error message: “LIMIT_EXCEEDED: Too many files retried in a single retrieve call, limit is 1500.” The Metadata API, which the Force.com IDE uses to communicate with the server, enforces these limits per each deploy/retrieve transaction.

iii. Once you have created your project, press Ctrl-H to perform a search.
1. Search for the name of the instance that your org resides on, for example: NA4. See Figure 1 below.
a. If you have multiple projects open, right-click on each project you don’t want to search on and choose “Close Project” or modify the search criteria so that you have a “working set” to minimize the files you’re searching on.”

It is not best practices to hard code instances in your org.

Fix :

Use the relative URL. Instead of using https://na22.salesforce.com/001/e?retURL=/home/home.jsp use /001/e?retURL=/home/home.jsp. Leave out the Instance or host part of the URL.

Secondly, https://login.salesforce.com/001/e?retURL=/home/home.jsp will also work.

Salesforce (Thailand) locale forwarded 543 years.

When you have multiple locales enabled in your Salesforce Org and the date function of your code uses the locale set in the system for the user, the Thai locale will increase the years by 543. This was actually done by design to follow the user’s locales.

Wikipedia : “The Thai solar calendar, was adopted by King Chulalongkorn (Rama V) in AD 1888 as the Siamese version of the Gregorian calendar, replacing the Thai lunar calendar as the legal calendar in Thailand (though the latter is still also used, especially for traditional and religious events). Years are now counted in the Buddhist Era (B.E.)) which is 543 years ahead of the Christian/Common Era.”
https://en.wikipedia.org/wiki/Thai_solar_calendar

Fix: You will need to use another locale for the user or calculate off the 543 in all date functions in your code for Locale : Thailand.