0

The below query works fine where setCaseId='hds88899889':

SELECT Id, DeveloperName FROM RecordType WHERE SObjectType ='Case' AND Id = :setCaseId

When I used it below not sure always results into no values

Set<Id> setCaseRTId = new Set<Id>();
for(case c : newCases) {  
    setCaseRTId.add(c.recordTypeId); 
} 
Map<Id, RecordType> caseMap = new Map<Id, RecordType>([ SELECT Id, DeveloperName
                                    FROM RecordType WHERE SObjectType ='Case' AND Id = :setCaseRTId]);
System.debug('Map Values ? : '+caseMap);
  • Are the values all null? What do you actually get as the output of setCaseRTId? – Adrian Larson Jul 26 '17 at 18:45
  • setCaseRTId is comming with values which is correct – user46657 Jul 26 '17 at 18:53
  • 3
    No need to use SobjectType='Case', because Id values are always unique. – sfdcfox Jul 26 '17 at 19:28
  • 1
    Looks like you need an IN in your query. AND Id IN :setCaseRTId – JRiffe Jul 26 '17 at 21:33
  • @JRiffe Actually the filter works either way. – Adrian Larson Jul 27 '17 at 0:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy