'Salesforce CASESAFEID(Id): Last 03 digits of all the record ids are coming up same

I am testing CASESAFEID(Id) function to get the 18-digit ids in my report. I created a formula field and used that field in a report. I am noticing that the last 03 characters of most of the records in this field are the same. I could not find the reason or logic for these 03 characters on google search to posting it here.

My formula field: enter image description here

My report: enter image description here

I am using trailhead playground for this testing.



Solution 1:[1]

They're essentially a checksum-type value to ensure that valid Salesforce Ids do not differ from one another only in case. This provides safety for tools like Excel that treat abc and AbC as the same value.

The behavior you are observing is normal. There's no need to test this formula function as such; it's a standard part of the platform.

Solution 2:[2]

Check if this works.

<?php

$data = json_decode($your_json);

$qualificationTier = "qualificationTier"; 

// qualificationTier name is at position 13 in characteristic array

$QualificationTierName = $data->site->place->characteristic[13]->name;

$QualificationTierValue = "";

// Confirm indeed if the string name at position 13 in characteristics is indeed qualificationTier before retrieving the value at the same position
if(strcmp($qualificationTier, $QualificationTierName) == 0 ){

    // qualificationTier value is at position 13 in characteristic array
    $QualificationTierValue = $data->site->place->characteristic[13]->value;
    echo "QualificationTier Name : " + $QualificationTierName; 
    echo "QualificationTier Value : " + $QualificationTierValue;
}

?>

Solution 3:[3]

A simple way would be to loop the array and get value when the name matches your field. You should first decode the json response so you will have an object to work with. Then just loop and set the variable when you have a match.

<?php

$response = json_decode($_POST['json-name']);

$qualificationTier = null;

foreach ($response->site->place->characteristic as $c) {
    if ($c->name === 'qualificationTier') {
        $qualificationTier = $c->value;
    }
}

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 David Reed
Solution 2 Joseph
Solution 3