I've got a picklist Activity1__c
with 2 values that don't actually exist in the metadata: "Reverse Reference - Completed" and "Reverse Reference - Incomplete". In other words those picklist values aren't defined.
However, they exist as someone has effectively set those values when writing to that field.
When I try to query this though like below, nothing is being fetched through.
List<Activity_Log__c> reverseReferencesList = new List<Activity_Log__c>();
for (Activity_Log__c a : [SELECT Id, Candidate__c, Person__c, Activity1__c FROM Activity_Log__c WHERE OwnerId = :user AND Activity1__c LIKE '%Reverse Reference%' AND CreatedDate >= :startDate AND CreatedDate < :endDate]) {
if (String.valueOf(a.Activity1__c) == 'Reverse Reference - Completed') {
reverseReferencesList.add(a);
}
}
If I remove the if
statement and just add those records to reverseReferencesList
, records will appear in the Visualforce page. However if I try to specifically find "Reverse Reference - Completed", it returns nothing.
I've tried:
- Specifically querying for "Reverse Reference - Completed"
- Getting the
String.valueOf()
and filtering (as in the example), still returns nothing - Adding the values to the PickList's metadata, but that has no effect
Is there any way around this for finding records by PickList value that aren't defined in the PickList metadata itself, but are written to the record?