Print this page

Create a User ID (18-digits) using custom formula field

Knowledge Article Number 000044639
Description Create a User ID (18-digits) using custom formula field due to the following limitations:
  1. User object cannot create workflow -> field update
  2. There is a max no of formula characters in each custom formula field.
Admin hasn't been able to create User ID (18-digits) in Salesforce for reporting purpose. It returns below error when using the single formula directly under custom formula field.

"Error: Compiled formula is too big to execute (7,771 characters). Maximum size is 5,000 characters"
Resolution
Id &
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(Id,1,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(Id,2,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(Id,3,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(Id,4,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(Id,5,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1) 
&
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(Id,6,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(Id,7,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(Id,8,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(Id,9,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(Id,10,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1) 
&
MID("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345",( 
IF(FIND(MID(Id,11,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,1,0) 
+IF(FIND(MID(Id,12,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,2,0) 
+IF(FIND(MID(Id,13,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,4,0) 
+IF(FIND(MID(Id,14,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,8,0) 
+IF(FIND(MID(Id,15,1), "ABCDEFGHIJKLMNOPQRSTUVWXYZ")>0,16,0) 
)+1,1)

Note - By the same logic it is possible to get the 18 digit ID of other records too and not just user record




promote demote