This question already has an answer here:

I have an 18 character Salesforce ID:


When it's used in an SOQL query:

Id recordId = Id.valueOf('XXXXJ00000326hjQAA');
List<Opportunity> records = [SELECT ID FROM Opportunity WHERE ID = :recordId];

It returns 1 record.

But when the 18 character Salesforce ID is all upper case:


It returns 0 records.

I thought 18 character Salesforce ID's were case-insensitive.

Why is it not returning a record?

marked as duplicate by Community Jul 2 at 11:27

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.