Salesforce Fact #415 | Cache.Session getKeys() iteration

If we store the numeric indexes on the Salesforce org Session Cache as String value and if we try to retrieve them using getKeys() method, it returns a sorted set and there could be issue if there are more than 9 values since the comparison is based on String, not numeric value.

As a workaround, we can use the length of the keySet and iterate to get the correct value as per the index value.

Attached is the screenshot.



Comments

Popular posts from this blog

Salesforce Fact #192 | Call batch apex from flow

Salesforce Fact #457 | Get current user role name in flow