0

I have two IDs that are the same when comparing the 15 character version of each other (the only difference is capitalization). When I attempt to query the data for ID #1 I am receiving the data from ID #2. I tried querying the 18 character version of ID#1 but nothing gets returned? Has anyone ever encountered this issue before?

ID#1 = a1e1E000002KVhJQAW ID#2 = a1e1E000002KVhjQAG

for example by query is: SELECT Name FROM Contact WHERE ActiveDUId__c='a1e1E000002KVhJQAW' and nothing is returned

4
  • 1
    where did these Ids come from? also, records won't be returned if the running user doesn't have record visibility to that record
    – cropredy
    Nov 18, 2021 at 18:03
  • If you're doing this from Apex using variables of the Id type, the query should not return records of the other id (assuming the capitalization is correct). Internally in Apex, only 18 character ids are used. Like cropredy said, it could be a sharing issue, maybe you can try to make the class without sharing to rule that out. Nov 18, 2021 at 18:19
  • 1
    Looks like you've a text field that keeps the ID value. You may want to convert to a relationship field instead or do a substring to 15 characters & query for records. Nov 18, 2021 at 18:23
  • I figured it out thanks to all of your help. Something was being triggered that was trimming the contact's activeDUId and then updating the contact. As a result, I was unable to make any query's for the 18 character ID. Code now works. Thanks for everyone's answers.
    – user107340
    Nov 18, 2021 at 20:03

0