function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
SAI CHARAN MADUGULASAI CHARAN MADUGULA 

I want to add or || in this condition

Hi,

I need to add or || condition by adding this account record types.In this code i have marked as Bold there i have to add this two Account Record Type  can anyone please help me out for this.
  • 'LTC Customer Facility'
  • 'LTC Former Facility'

  if(!ocrIdSet.isEmpty()){
            List<OCR_Pharmacy__c> ocrAccList = [
                Select Id,Address__c
                     , City__c
                     , State_Province__c
                     , Zip_Postal_Code__c
                     , Country__c
                     , (Select Id
                             , Distance_to_Service_Facility__c 
                          from Accounts__r
                         where (RecordType.Name = 'LTC Prospect Facility'
                                        
                                
                         ) 
                           
                       )
                  from OCR_Pharmacy__c where Id IN : ocrIdSet
            ];

Thanks,
sai charan
Best Answer chosen by SAI CHARAN MADUGULA
karthikeyan perumalkarthikeyan perumal
Hello 

Use Below updated Code, 
 
if(!ocrIdSet.isEmpty()){
            List<OCR_Pharmacy__c> ocrAccList = [
                Select Id,Address__c
                     , City__c
                     , State_Province__c
                     , Zip_Postal_Code__c
                     , Country__c
                     , (Select Id
                             , Distance_to_Service_Facility__c 
                          from Accounts__r
                         where RecordType.Name = 'LTC Prospect Facility' 
						 OR 
						 RecordType.Name='LTC Customer Facility' 
						 OR 
						 RecordType.Name='LTC Former Facility'
                       )
                  from OCR_Pharmacy__c where Id IN : ocrIdSet
            ];

Hope this will help you.. 
Mark Best ANSWER if its work for you. 

Thanks
karthik
 

All Answers

karthikeyan perumalkarthikeyan perumal
Hello 

Use Below updated Code, 
 
if(!ocrIdSet.isEmpty()){
            List<OCR_Pharmacy__c> ocrAccList = [
                Select Id,Address__c
                     , City__c
                     , State_Province__c
                     , Zip_Postal_Code__c
                     , Country__c
                     , (Select Id
                             , Distance_to_Service_Facility__c 
                          from Accounts__r
                         where RecordType.Name = 'LTC Prospect Facility' 
						 OR 
						 RecordType.Name='LTC Customer Facility' 
						 OR 
						 RecordType.Name='LTC Former Facility'
                       )
                  from OCR_Pharmacy__c where Id IN : ocrIdSet
            ];

Hope this will help you.. 
Mark Best ANSWER if its work for you. 

Thanks
karthik
 
This was selected as the best answer
SAI CHARAN MADUGULASAI CHARAN MADUGULA
Thank you
karthikeyan perumalkarthikeyan perumal
Mark Best ANSWER  if it works for you.. 

Thanks
karthik