Skip to main content

Solution to Compare Salesforce IDs

 

Purpose

 

This formula converts the Salesforce ID into a numeric value, allowing you to compare IDs directly using greater-than (>) or less-than (<) operators. 

 

  1. Define IdChars: IdChars = '01234567890ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'    

    This string represents the character set used in Salesforce IDs.

  2. Convert ID to Numeric Value:    

    Use the

    FIND function to locate the position of each character in the IdChars string and calculate a numeric value for the ID.    

    Example formula:

(FIND(MID(AccountId, 4, 1), IdChars) - 1) * 100000000000000 +(FIND(MID(AccountId, 5, 1), IdChars) - 1) * 1000000000000 +(FIND(MID(AccountId, 10, 1), IdChars) - 1) * 10000000000 +(FIND(MID(AccountId, 11, 1), IdChars) - 1) * 100000000 +(FIND(MID(AccountId, 12, 1), IdChars) - 1) * 1000000 +(FIND(MID(AccountId, 13, 1), IdChars) - 1) * 10000 +(FIND(MID(AccountId, 14, 1), IdChars) - 1) * 100 +(FIND(MID(AccountId, 15, 1), IdChars) - 1)

 

Now you can compare ID Numeric Value 1 with ID Numeric Value 2 using greater-than (>) or less-than (<) operators. 

 

#Flow Formula  #FlowBuilder

 

 

#Flow

0/9000