From 85823f81e123e5163188ec23d37c0ee0e68c9cfd Mon Sep 17 00:00:00 2001 From: RanadheerRG Date: Wed, 30 Oct 2024 08:11:43 -0700 Subject: [PATCH] Updated the status to -1 --- src/main/default/classes/FetchAndGenerateCSV.cls | 4 ++-- src/main/default/classes/FetchAndGenerateCSVTest.cls | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/default/classes/FetchAndGenerateCSV.cls b/src/main/default/classes/FetchAndGenerateCSV.cls index a25cc1f4..782c3bf2 100644 --- a/src/main/default/classes/FetchAndGenerateCSV.cls +++ b/src/main/default/classes/FetchAndGenerateCSV.cls @@ -37,7 +37,7 @@ public with sharing class FetchAndGenerateCSV { List accounts = [SELECT Id, RegId__c, Name, HealthAuthority__c, ExemptionofAddressPublication__c, Phone, Extension__c, Fax, Website, Status__c, Parent.Name, (SELECT ContactId, PrimaryContact__c, Contact.Name FROM AccountContactRelations WHERE PrimaryContact__c = true LIMIT 1), (SELECT RegistrationCertificate__c FROM AccountBusinessLicenses__r WHERE Status = 'Active' LIMIT 1), - (SELECT ServiceName__c FROM Services__r WHERE ServiceName__c IN: serviceNameList LIMIT 50), + (SELECT ServiceName__c, Status__c FROM Services__r WHERE ServiceName__c IN: serviceNameList LIMIT 50), (SELECT Id, Location.VisitorAddress.Address FROM AssociatedLocations WHERE ActiveTo = NULL LIMIT 1), Account.LicenseType__r.RegulatoryAuthorizationCode__c, (SELECT Quantity, Type__c FROM Assets WHERE Type__c IN: typeList AND ParentId = NULL AND Quantity > 0.00) @@ -140,7 +140,7 @@ public with sharing class FetchAndGenerateCSV { // Helper method to get the service flag private static String getServiceFlag(List services, String serviceName){ for(Service__c service : services){ - if(!String.isEmpty(serviceName) && serviceName.containsIgnoreCase(service.ServiceName__c)){ + if(service.Status__c == 'Active' && service.ServiceName__c == serviceName){ return '-1'; // Flag '-1' if service name is found } } diff --git a/src/main/default/classes/FetchAndGenerateCSVTest.cls b/src/main/default/classes/FetchAndGenerateCSVTest.cls index b800629d..1fc25a9f 100644 --- a/src/main/default/classes/FetchAndGenerateCSVTest.cls +++ b/src/main/default/classes/FetchAndGenerateCSVTest.cls @@ -60,6 +60,7 @@ private class FetchAndGenerateCSVTest { ServiceName__c = 'Assistance with daily living activities', ServiceType__c = 'Assisted Living Service', ProvidedBy__c = 'Registrant', + Status__c = 'Active', Account__c = Residence.id ); insert ser; @@ -122,6 +123,7 @@ private class FetchAndGenerateCSVTest { ServiceName__c = 'Assistance with daily living activities', ServiceType__c = 'Assisted Living Service', ProvidedBy__c = 'Registrant', + Status__c = 'Active', Account__c = Residence.id ); insert ser;