From ce11ffff7daed34c1d97773988ae12e20f636739 Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Mon, 23 Dec 2024 09:04:27 -0500 Subject: [PATCH 01/12] Changes related to EDRD-1150 --- ...countContactRelationTriggerHandlerTest.cls | 186 ++++++++++++++++++ .../AccountContactRelationTriggerHandler.cls | 138 ++++++++++++- .../default/classes/EDRD_cls_HandleGroups.cls | 108 ++++++++++ .../EDRD_cls_HandleGroups.cls-meta.xml | 5 + .../classes/EDRD_cls_HandleGroupsTest.cls | 18 ++ .../EDRD_cls_HandleGroupsTest.cls-meta.xml | 5 + .../classes/ESA_cls_accountTriggerHandler.cls | 75 ++++++- .../ESA_cls_accountTriggerHandlerTest.cls | 9 + .../default/classes/ESA_cls_constants.cls | 22 ++- .../main/default/classes/TestFactory.cls | 18 ++ ...mittee.EDRD_Advisory_Committee.md-meta.xml | 13 ++ ...ttee.EDRD_Cardiac_Subcommittee.md-meta.xml | 13 ++ ...D_Cystic_Fibrosis_Subcommittee.md-meta.xml | 13 ++ ...e.EDRD_Hematology_Subcommittee.md-meta.xml | 13 ++ ...e.EDRD_Immunology_Subcommittee.md-meta.xml | 13 ++ ...ee.EDRD_Metabolic_Subcommittee.md-meta.xml | 13 ++ ...e.EDRD_Nephrology_Subcommittee.md-meta.xml | 13 ++ ...ee.EDRD_Neurology_Subcommittee.md-meta.xml | 13 ++ ...DRD_Ophthalmology_Subcommittee.md-meta.xml | 13 ++ ...blic_Grp_vs_Committee__mdt.object-meta.xml | 6 + .../fields/Committee_Name__c.field-meta.xml | 11 ++ .../EDRD_Public_Group_Name__c.field-meta.xml | 11 ++ .../AccountContactRelationTrigger.trigger | 5 + .../triggers/ESA_tgr_accountTrigger.trigger | 2 + 24 files changed, 727 insertions(+), 9 deletions(-) create mode 100644 force-app/main/default/classes/EDRD_cls_HandleGroups.cls create mode 100644 force-app/main/default/classes/EDRD_cls_HandleGroups.cls-meta.xml create mode 100644 force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls create mode 100644 force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cardiac_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cystic_Fibrosis_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Hematology_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Immunology_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Metabolic_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Nephrology_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Neurology_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Ophthalmology_Subcommittee.md-meta.xml create mode 100644 force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/EDRD_Public_Grp_vs_Committee__mdt.object-meta.xml create mode 100644 force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/Committee_Name__c.field-meta.xml create mode 100644 force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/EDRD_Public_Group_Name__c.field-meta.xml diff --git a/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls b/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls index 652404ed4..b6c9a15b4 100644 --- a/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls +++ b/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls @@ -3,6 +3,9 @@ * @Date: 21/08/2024 * @Description: The purpose of this class is to cover Code coverage of AccountContactRelationTriggerHandler * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] + 21 Aug - EDRD-911 - Accenture - Added Patient Share/delete With Provider User + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to update Committee based on ACR insert of EDRD_Committee & Provider OR Committee_Reviewer. + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. ***********************************************************************************************/ @isTest public class AccountContactRelationTriggerHandlerTest { @@ -124,4 +127,187 @@ public class AccountContactRelationTriggerHandlerTest { Assert.areNotEqual(accShareList2.size(), NULL, 'AccountShare record should is not created'); Assert.areNotEqual(accShareList2.isEmpty(), true, 'AccountShare record list cannot be empty, after the ACR is updated'); } + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this method is to cover Testcoverage of updateCommitteeFieldOnACRInsert +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @isTest + public static void updateCommitteeFieldOnACRInsertTest(){ + List providerList = new List(); + Account providerAcc = TestFactory.newProvider('Provider'); + providerAcc.Provider_Type__pc = 'Physician'; + providerList.add(providerAcc); + Account providerAcc2 = TestFactory.newProvider('Provider2'); + providerAcc2.Provider_Identifier__pc = '111222'; + providerAcc2.Provider_Type__pc = 'Physician'; + providerList.add(providerAcc2); + Account providerAcc3 = TestFactory.newProvider('Provider3'); + providerAcc3.Committee__pc = 'EDRD Sub Committee'; + providerAcc3.Committee_Name__pc = 'Metabolic Subcommittee'; + providerAcc3.Provider_Identifier__pc = '1112223'; + providerAcc3.Provider_Type__pc = 'Physician'; + providerList.add(providerAcc3); + Account providerAcc4 = TestFactory.newProvider('Provider4'); + providerAcc4.Committee__pc = 'EDRD Advisory Committee'; + providerAcc4.Provider_Identifier__pc = '1112224'; + providerAcc4.Provider_Type__pc = 'Physician'; + providerList.add(providerAcc4); + Account providerAcc5 = TestFactory.newProvider('Provider5'); + providerAcc5.Committee__pc = 'EDRD Advisory/ Sub Committee'; + providerAcc5.Committee_Name__pc = 'Cystic Fibrosis Subcommittee;Ophthalmology Subcommittee'; + providerAcc5.Provider_Identifier__pc = '1112225'; + providerAcc5.Provider_Type__pc = 'Physician'; + providerList.add(providerAcc5); + insert providerList; + + List committeeList = new List(); + Account sCBusinessAcc = TestFactory.createEDRDSCAccount('Metabolic Subcommittee'); + committeeList.add(sCBusinessAcc); + Account sCBusinessAcc1 = TestFactory.createEDRDSCAccount('Cardiac Subcommittee'); + committeeList.add(sCBusinessAcc1); + Account aCBusinessAcc = TestFactory.createEDRDACAccount('EDRD Advisory Committee'); + committeeList.add(aCBusinessAcc); + insert committeeList; + + List aCRListTOInsert = new List(); + Id providerContactId = [SELECT Id FROM Contact Where accountId =: providerAcc.Id].get(0).Id; + AccountContactRelation ACRObj = new AccountContactRelation(); + ACRObj.AccountId = sCBusinessAcc.Id; + ACRObj.ContactId = providerContactId; + ACRObj.Roles = 'Reviewer'; + aCRListTOInsert.add(ACRObj); + Id provider2ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc2.Id].get(0).Id; + AccountContactRelation ACRObj2 = new AccountContactRelation(); + ACRObj2.AccountId = aCBusinessAcc.Id; + ACRObj2.ContactId = provider2ContactId; + ACRObj2.Roles = 'Chair'; + aCRListTOInsert.add(ACRObj2); + Id provider3ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc3.Id].get(0).Id; + AccountContactRelation ACRObj3 = new AccountContactRelation(); + ACRObj3.AccountId = aCBusinessAcc.Id; + ACRObj3.ContactId = provider3ContactId; + ACRObj3.Roles = 'Vice Chair'; + aCRListTOInsert.add(ACRObj3); + Id provider4ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc4.Id].get(0).Id; + AccountContactRelation ACRObj4 = new AccountContactRelation(); + ACRObj4.AccountId = sCBusinessAcc1.Id; + ACRObj4.ContactId = provider4ContactId; + ACRObj4.Roles = 'Vice Chair'; + aCRListTOInsert.add(ACRObj4); + Id provider5ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc5.Id].get(0).Id; + AccountContactRelation ACRObj5 = new AccountContactRelation(); + ACRObj5.AccountId = sCBusinessAcc1.Id; + ACRObj5.ContactId = provider5ContactId; + ACRObj5.Roles = 'Chair'; + aCRListTOInsert.add(ACRObj5); + AccountContactRelation ACRObj6 = new AccountContactRelation(); + ACRObj6.AccountId = sCBusinessAcc1.Id; + ACRObj6.ContactId = provider3ContactId; + ACRObj6.Roles = 'Reviewer'; + aCRListTOInsert.add(ACRObj6); + AccountContactRelation ACRObj7 = new AccountContactRelation(); + ACRObj7.AccountId = aCBusinessAcc.Id; + ACRObj7.ContactId = provider4ContactId; + ACRObj7.Roles = 'Chair'; + aCRListTOInsert.add(ACRObj7); + AccountContactRelation ACRObj8 = new AccountContactRelation(); + ACRObj8.AccountId = aCBusinessAcc.Id; + ACRObj8.ContactId = provider5ContactId; + ACRObj8.Roles = 'Vice Chair'; + aCRListTOInsert.add(ACRObj8); + + Test.startTest(); + insert aCRListTOInsert; + Test.stopTest(); + + Map updatedProviders = new Map([SELECT Id, Committee__pc, Committee_Name__pc FROM Account + WHERE Id IN (:providerAcc.Id, :providerAcc2.Id, :providerAcc3.Id)]); + + Account updatedProviderAccount = updatedProviders.get(providerAcc.Id); + Assert.areEqual(updatedProviderAccount.Committee__pc, 'EDRD Sub Committee', 'Provider Record should be updated'); + Assert.areNotEqual(updatedProviderAccount.Committee_Name__pc, NULL, 'Committee_Name__pc on provider field should not be NULL'); + Assert.areEqual(updatedProviderAccount.Committee_Name__pc, 'Metabolic Subcommittee', 'Provider Committee_Name__pc should be updated'); + + Account updatedProviderAccount2 = updatedProviders.get(providerAcc2.Id); + Assert.areEqual(updatedProviderAccount2.Committee__pc, 'EDRD Advisory Committee','Provider Record should be updated'); + Assert.areEqual(updatedProviderAccount2.Committee_Name__pc, NULL, 'Provider2 Committee_Name__pc should be NULL'); + + Account updatedProviderAccount3 = updatedProviders.get(providerAcc3.Id); + Assert.areEqual(updatedProviderAccount3.Committee__pc, 'EDRD Advisory/ Sub Committee', 'Provider3 Record should be updated'); + Assert.areNotEqual(updatedProviderAccount3.Committee_Name__pc, NULL, 'Committee_Name__pc on provider3 field should not be NULL'); + Assert.areEqual(updatedProviderAccount3.Committee_Name__pc, 'Cardiac Subcommittee;Metabolic Subcommittee', 'Provider Committee_Name__pc should be updated'); + } + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this method is to cover Testcoverage of removeCommitteeFieldOnACRDelete +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @isTest + public static void removeCommitteeFieldOnACRDeleteTest(){ + List providerAccList = new List(); + Account provider = TestFactory.newProvider('Provider'); + provider.Provider_Type__pc = 'Physician'; + providerAccList.add(provider); + Account provider2 = TestFactory.newProvider('Provider2'); + provider2.Provider_Identifier__pc = '111222'; + provider2.Provider_Type__pc = 'Physician'; + providerAccList.add(provider2); + Account provider3 = TestFactory.newProvider('Provider3'); + provider3.Committee__pc = 'EDRD Sub Committee'; + provider3.Committee_Name__pc = 'Metabolic Subcommittee'; + provider3.Provider_Identifier__pc = '1112223'; + provider3.Provider_Type__pc = 'Physician'; + providerAccList.add(provider3); + insert providerAccList; + + List committeeList = new List(); + Account sCBusinessAcc = TestFactory.createEDRDSCAccount('Metabolic Subcommittee'); + committeeList.add(sCBusinessAcc); + Account aCBusinessAcc = TestFactory.createEDRDACAccount('EDRD Advisory Committee'); + committeeList.add(aCBusinessAcc); + insert committeeList; + + List aCRListTOInsert = new List(); + Id providerContactId = [SELECT Id FROM Contact Where accountId =: provider.Id].get(0).Id; + AccountContactRelation ACRObj = new AccountContactRelation(); + ACRObj.AccountId = sCBusinessAcc.Id; + ACRObj.ContactId = providerContactId; + ACRObj.Roles = 'Reviewer'; + aCRListTOInsert.add(ACRObj); + Id provider2ContactId = [SELECT Id FROM Contact Where accountId =: provider2.Id].get(0).Id; + AccountContactRelation ACRObj2 = new AccountContactRelation(); + ACRObj2.AccountId = aCBusinessAcc.Id; + ACRObj2.ContactId = provider2ContactId; + ACRObj2.Roles = 'Chair'; + aCRListTOInsert.add(ACRObj2); + Id provider3ContactId = [SELECT Id FROM Contact Where accountId =: provider3.Id].get(0).Id; + AccountContactRelation ACRObj3 = new AccountContactRelation(); + ACRObj3.AccountId = aCBusinessAcc.Id; + ACRObj3.ContactId = provider3ContactId; + ACRObj3.Roles = 'Vice Chair'; + aCRListTOInsert.add(ACRObj3); + insert aCRListTOInsert; + + Test.startTest(); + delete aCRListTOInsert; + Test.stopTest(); + + Map accountMap = new Map([SELECT Id, Committee__pc, Committee_Name__pc FROM Account + WHERE Id IN :new Set{provider2.Id, provider3.Id}]); + + Account provider3AfterDelete = accountMap.get(provider3.Id); + Assert.areEqual(provider3AfterDelete.Committee__pc, 'EDRD Sub Committee', 'Committee should be null after deletion'); + Assert.areEqual(provider3AfterDelete.Committee_Name__pc, 'Metabolic Subcommittee', 'Committee Name should be null after deletion'); + Assert.areNotEqual(provider3AfterDelete.Committee__pc, NULL, 'Committee should not be null after deletion'); + Assert.areNotEqual(provider3AfterDelete.Committee_Name__pc, NULL, 'Committee Name should not be null after deletion'); + + Account provider2AfterDelete = accountMap.get(provider2.Id); + Assert.areEqual(provider2AfterDelete.Committee__pc, NULL, 'Provider2 Committee should not be null'); + Assert.areEqual(provider2AfterDelete.Committee_Name__pc, NULL, 'Provider2 Committee Name should remain unchanged'); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls b/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls index d696699ac..b8188b63d 100644 --- a/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls +++ b/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls @@ -4,6 +4,8 @@ * @Description: The purpose of this class is to create methods which can be used by different trigger event * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 21 Aug - EDRD-911 - Accenture - Added Patient Share/delete With Provider User + 13 Dec - EDRD-1150 - Accenture - The purpose of this method is to update Committee based on ACR insert of EDRD_Committee & Provider OR Committee_Reviewer. + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. ***********************************************************************************************/ public with sharing class AccountContactRelationTriggerHandler { /** @@ -109,5 +111,139 @@ public with sharing class AccountContactRelationTriggerHandler { createPatientShare(accShareListToInsert); } } - } + } + +/** +* @author: Deepak +* @date: 13 Dec 2024 +* @description: The purpose of this method is to update Committee based on ACR insert of EDRD_Committee & Provider OR Committee_Reviewer. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public static void updateCommitteeFieldOnACRInsert(List aCRList) { + Set contactIdSet = new Set(); + Set accountIdSet = new Set(); + Map providerIdVsRecToUpdate = new map(); + List aCRListToProcess = New List(); + Set accRecTypeSet = new Set{'EDRD_Committee', 'Provider', 'Committee_Reviewer'}; + try{ + for (AccountContactRelation aCRObj : aCRList) { + if (!String.isEmpty(aCRObj.Roles) && aCRObj.IsActive && + (aCRObj.Roles.containsIgnoreCase('Reviewer') || aCRObj.Roles.containsIgnoreCase('Chair') || aCRObj.Roles.containsIgnoreCase('Vice Chair'))){ + contactIdSet.add(aCRObj.ContactId); + accountIdSet.add(aCRObj.AccountId); + aCRListToProcess.add(aCrObj); + } + } + + Map accIdVsRec = new Map([SELECT Id, Recordtype.DeveloperName, EDRD_Committee_Type__c, Name FROM Account Where Id IN: accountIdSet]); + Map contactIdVsRec = new Map([SELECT Id, Contact.AccountId, Contact.Account.Recordtype.DeveloperName, Contact.Account.Committee__pc, Contact.Account.Committee_Name__pc FROM Contact Where Id IN: contactIdSet]); + Account providerAccount = new Account(); + for(AccountContactRelation acRObj: aCRListToProcess){ + providerAccount = contactIdVsRec.get(aCrObj.ContactId).Account; + Account businessAccount = accIdVsRec.get(aCrObj.AccountId); + if(accRecTypeSet.Contains(businessAccount.RecordType.DeveloperName) || (accRecTypeSet.Contains(providerAccount.RecordType.DeveloperName))){ + String businessCommitteeTypes = businessAccount.EDRD_Committee_Type__c; + String oldProviderCommittee = providerAccount.Committee__pc; + + if (ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == NULL) { + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAccount.Committee_Name__pc = providerAccount.Committee_Name__pc != NULL ? providerAccount.Committee_Name__pc +';'+ businessAccount.Name : businessAccount.Name; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if (ESA_cls_constants.EDRD_BUSINESS_AC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == NULL) { + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_AC; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if(ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == ESA_cls_constants.EDRD_PERSONACCOUNT_SC){ + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAccount.Committee_Name__pc = providerAccount.Committee_Name__pc != NULL ? providerAccount.Committee_Name__pc +';'+ businessAccount.Name : businessAccount.Name; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if(ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == ESA_cls_constants.EDRD_PERSONACCOUNT_AC){ + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + providerAccount.Committee_Name__pc = providerAccount.Committee_Name__pc != NULL ? providerAccount.Committee_Name__pc +';'+ businessAccount.Name : businessAccount.Name; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if (ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC){ + providerAccount.Committee_Name__pc = providerAccount.Committee_Name__pc != NULL ? providerAccount.Committee_Name__pc +';'+ businessAccount.Name : businessAccount.Name; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if(ESA_cls_constants.EDRD_BUSINESS_AC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == ESA_cls_constants.EDRD_PERSONACCOUNT_SC){ + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if(ESA_cls_constants.EDRD_BUSINESS_AC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == ESA_cls_constants.EDRD_PERSONACCOUNT_AC){ + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_AC; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } else if(ESA_cls_constants.EDRD_BUSINESS_AC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC){ + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + providerIdVsRecToUpdate.put(providerAccount.Id, providerAccount); + } + } + } + + if (!providerIdVsRecToUpdate.isEmpty()) { + Database.update(providerIdVsRecToUpdate.values(), true); + } + }catch (DmlException e) { + System.debug('Error Updating Provider/Reviewer record: ' + e.getMessage()); + } + } + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public static void removeCommitteeFieldOnACRDelete(List aCRList) { + Set contactIdSet = new Set(); + Set accountIdSet = new Set(); + List aCRListToIterate = new List(); + Map providerIdVsRecToUpdate = new Map(); + Set accRecTypeSet = new Set{'EDRD_Committee', 'Provider', 'Committee_Reviewer'}; + + try { + for (AccountContactRelation aCRObj : aCRList) { + if (!String.isEmpty(aCRObj.Roles) && + (aCRObj.Roles.containsIgnoreCase('Reviewer') || aCRObj.Roles.containsIgnoreCase('Chair') || aCRObj.Roles.containsIgnoreCase('Vice Chair'))) { + contactIdSet.add(aCRObj.ContactId); + accountIdSet.add(aCRObj.AccountId); + aCRListToIterate.add(aCRObj); + } + } + + Map accIdVsRec = new Map([SELECT Id, RecordType.DeveloperName, EDRD_Committee_Type__c, Committee__pc, Committee_Name__pc, Name + FROM Account WHERE Id IN :accountIdSet]); + Map contactIdVsRec = new Map([SELECT Id, AccountId, Account.RecordType.DeveloperName, Account.Committee__pc, Account.Committee_Name__pc, Account.FirstName, Account.LastName + FROM Contact WHERE Id IN :contactIdSet]); + + for (AccountContactRelation aCRObj : aCRListToIterate) { + Account providerAccount = contactIdVsRec.get(aCrObj.ContactId)?.Account; + Account businessAccount = accIdVsRec.get(aCrObj.AccountId); + String sCToRemove = accIdVsRec.get(aCRObj.AccountId)?.Name; + String businessCommitteeTypes = businessAccount.EDRD_Committee_Type__c; + + if(ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && (providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_SC || providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC)){ + if(providerAccount.Committee_Name__pc.Contains(sCToRemove)){ + Set committeeSet = new Set(providerAccount.Committee_Name__pc.Split(';')); + committeeSet.remove(sCToRemove); + + if(!committeeSet.isEmpty()){ + providerAccount.Committee__pc = (providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_SC) ? ESA_cls_constants.EDRD_PERSONACCOUNT_SC : ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + providerAccount.Committee_Name__pc = String.join(committeeSet, ';'); + providerIdVsRecToUpdate.put(providerAccount.Id, new Account(Id = providerAccount.Id, Committee__pc = providerAccount.Committee__pc, Committee_Name__pc = providerAccount.Committee_Name__pc)); + } else { + providerAccount.Committee__pc = (providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC) ? ESA_cls_constants.EDRD_PERSONACCOUNT_AC : NULL ; + providerAccount.Committee_Name__pc = NULL; + providerIdVsRecToUpdate.put(providerAccount.Id, new Account(Id = providerAccount.Id, Committee__pc = providerAccount.Committee__pc, Committee_Name__pc = NULL)); + } + } + }else if(ESA_cls_constants.EDRD_BUSINESS_AC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && (providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_AC || providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC)){ + providerAccount.Committee__pc = (providerAccount.Committee__pc == ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC) ? ESA_cls_constants.EDRD_PERSONACCOUNT_SC : NULL; + providerIdVsRecToUpdate.put(providerAccount.Id, new Account(Id = providerAccount.Id, Committee__pc = providerAccount.Committee__pc, Committee_Name__pc = providerAccount.Committee_Name__pc)); + } + } + + if (!providerIdVsRecToUpdate.isEmpty()) { + Database.update(providerIdVsRecToUpdate.values(), true); + } + } catch (DmlException e) { + System.debug('Error Removing Committee from Provider/Reviewer record: ' + e.getMessage()); + } + } } \ No newline at end of file diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls new file mode 100644 index 000000000..f345b767d --- /dev/null +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls @@ -0,0 +1,108 @@ +/********************************************************************************************** +* @Author: Accenture +* @Date: 09 Mar 2023 +* @Description: The purpose of this class is to Adding/Removing - Provider/Reviewer to public groups in without sharing context. +* @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] + 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. +***********************************************************************************************/ +public without Sharing class EDRD_cls_HandleGroups { + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this method is to Adding/Removing - Provider/Reviewer to public groups based on EDRD Committees in future transcation. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @future + public Static void handleGroupMembership(List perConIdVsOldCommitteeNameSTRList, List perConIdVsNewCommitteeNameSTRList){ + Map> perConIdVsOldCommittesName = new Map>(); + Map> perConIdVsnewCommitteeName = new Map>(); + Map committeeToGroupMap = new Map(); + Map> perConIdVsOldGroupName = new Map>(); + Map> perConIdVsnewGroupName = new Map>(); + Map groupNameVsGroupId = new Map(); + List groupMemberToDelete = new List(); + List groupMemberToInsert = new List(); + + for(String wrapperOldSTR : perConIdVsOldCommitteeNameSTRList){ + ESA_cls_accountTriggerHandler.groupMemberWrapper gMWObj = ESA_cls_accountTriggerHandler.parse(wrapperOldSTR); + if(!perConIdVsOldCommittesName.ContainsKey(gMWObj.personContactId)){ + perConIdVsOldCommittesName.put(gMWObj.personContactId, new set()); + } + for(ESA_cls_accountTriggerHandler.cls_committiees committeeObj: gMWObj.committiees){ + perConIdVsOldCommittesName.get(gMWObj.personContactId).add(committeeObj.committeeName); + } + } + + for(String wrapperNewSTR : perConIdVsNewCommitteeNameSTRList){ + ESA_cls_accountTriggerHandler.groupMemberWrapper gMWObj = ESA_cls_accountTriggerHandler.parse(wrapperNewSTR); + if(!perConIdVsnewCommitteeName.ContainsKey(gMWObj.personContactId)){ + perConIdVsnewCommitteeName.put(gMWObj.personContactId, new set()); + } + for(ESA_cls_accountTriggerHandler.cls_committiees committeeObj: gMWObj.committiees){ + perConIdVsnewCommitteeName.get(gMWObj.personContactId).add(committeeObj.committeeName); + } + } + + Set publicGroupName = new Set(); + for (EDRD_Public_Grp_vs_Committee__mdt metadataRecord : [SELECT Committee_Name__c, EDRD_Public_Group_Name__c FROM EDRD_Public_Grp_vs_Committee__mdt]) { + committeeToGroupMap.put(metadataRecord.Committee_Name__c, metadataRecord.EDRD_Public_Group_Name__c); + publicGroupName.add(metadataRecord.EDRD_Public_Group_Name__c); + } + List groupList = [SELECT Id, Name, DeveloperName FROM Group WHERE DeveloperName IN: publicGroupName]; + + for(Id perContactId :perConIdVsOldCommittesName.KeySet()){ + for(String committeeName: perConIdVsOldCommittesName.get(perContactId)){ + if(!perConIdVsOldGroupName.containsKey(perContactId)){ + perConIdVsOldGroupName.put(perContactId, new Set()); + } + perConIdVsOldGroupName.get(perContactId).add(committeeToGroupMap.get(committeeName)); + } + } + + List userListToDelete = [SELECT Id, ContactId FROM User WHERE ContactId IN: perConIdVsOldGroupName.keySet()]; + + for(Group grpObj: groupList){ + groupNameVsGroupId.put(grpObj.Name, grpObj.Id); + } + Map groupIdVsUserGroupId = new Map(); + for(User userObj: userListToDelete){ + for(String groupName: perConIdVsOldGroupName.get(userObj.ContactId)){ + groupIdVsUserGroupId.put(groupNameVsGroupId.get(groupName), userObj.Id); + } + } + + if (!groupIdVsUserGroupId.isEmpty()) { + groupMemberToDelete = [Select Id FROM GroupMember Where GroupId IN: groupIdVsUserGroupId.keySet() AND UserOrGroupId IN: groupIdVsUserGroupId.values()]; + if (!groupMemberToDelete.isEmpty()) { + delete groupMemberToDelete; + } + } + + + for(Id perContactId :perConIdVsnewCommitteeName.KeySet()){ + for(String committeeName: perConIdVsnewCommitteeName.get(perContactId)){ + if(!perConIdVsNewGroupName.containsKey(perContactId)){ + perConIdVsNewGroupName.put(perContactId, new Set()); + } + perConIdVsNewGroupName.get(perContactId).add(committeeToGroupMap.get(committeeName)); + } + } + + List userList = [SELECT Id, ContactId FROM User WHERE ContactId IN: perConIdVsNewGroupName.keySet()]; + + for(Group grpObj: groupList){ + groupNameVsGroupId.put(grpObj.DeveloperName, grpObj.Id); + } + + for(User userObj: userList){ + for(String groupName: perConIdVsNewGroupName.get(userObj.ContactId)){ + groupMemberToInsert.add(new GroupMember(groupId = groupNameVsGroupId.get(groupName), UserOrGroupId = userObj.Id)); + } + } + + if (!groupMemberToInsert.isEmpty()) { + insert groupMemberToInsert; + } + } +} \ No newline at end of file diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls-meta.xml b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls-meta.xml new file mode 100644 index 000000000..f5e18fd16 --- /dev/null +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls-meta.xml @@ -0,0 +1,5 @@ + + + 60.0 + Active + diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls b/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls new file mode 100644 index 000000000..3f365279f --- /dev/null +++ b/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls @@ -0,0 +1,18 @@ +/********************************************************************************************** +* @Author: Accenture +* @Date: 20/12/2024 +* @Description: The purpose of this class is to cover Code coverage of EDRD_cls_HandleGroups +* @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. +***********************************************************************************************/ +@isTest +public class EDRD_cls_HandleGroupsTest { + +/** +* @author: +* @date: 23 Dec 2024 +* @description: The purpose of this method is to cover Testcoverage of handleGroupMembership +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + +} \ No newline at end of file diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml b/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml new file mode 100644 index 000000000..f5e18fd16 --- /dev/null +++ b/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 60.0 + Active + diff --git a/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls b/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls index d7331016c..913d3ede7 100644 --- a/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls +++ b/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls @@ -1,9 +1,10 @@ /********************************************************************************************** -* @Author: Deepak +* @Author: Accenture * @Date: 09 Mar 2023 * @Description: The purpose of this class is to create methods which can be used by different trigger event * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 11 Nov - EDRD-82 - Accenture - Added Close Case method on Account Inactive + 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. ***********************************************************************************************/ public with sharing class ESA_cls_accountTriggerHandler { @@ -86,4 +87,76 @@ public with sharing class ESA_cls_accountTriggerHandler { AccountTriggerHelper.processDeceasedPatientEDRDCases(patientIdSet); } } + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this method is to Adding/Removing - Provider/Reviewer to public groups based on EDRD Committees. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public static void handlePublicGroupMemberships(Map oldAccountMap, Map newAccountMap) { + Map> perConIdVsOldCommittesName = new Map>(); + Map> perConIdVsnewCommitteeName = new Map>(); + Map accNameVsPerConId = new Map(); + + for (Id accountId : newAccountMap.keySet()) { + Account oldAccount = oldAccountMap.get(accountId); + Account newAccount = newAccountMap.get(accountId); + accNameVsPerConId.put(newAccount.Name, newAccount.PersonContactId); + + if (oldAccount.Committee__pc != null && oldAccount.Committee_Name__pc != null) { + perConIdVsOldCommittesName.put(oldAccount.perSonContactId, new Set(oldAccount.Committee_Name__pc.split(';'))); + } + if (newAccount.Committee__pc != null && newAccount.Committee_Name__pc != null) { + perConIdVsnewCommitteeName.put(newAccount.perSonContactId, new Set(newAccount.Committee_Name__pc.split(';'))); + } + } + List perConIdVsOldCommittesNameSTRList = new List(); + + for(Id perContactId: perConIdVsOldCommittesName.keySet()){ + groupMemberWrapper gMWObj = new groupMemberWrapper(); + gMWObj.personContactId = perContactId; + List committeList = new List(); + for(String committeeName : perConIdVsOldCommittesName.get(perContactId)){ + committeList.add(new cls_committiees(committeeName)); + } + gMWObj.committiees = committeList; + perConIdVsOldCommittesNameSTRList.add(JSON.serialize(gMWObj)); + } + + List perConIdVsnewCommitteeNameSTRList = new List(); + + for(Id perContactId: perConIdVsnewCommitteeName.keySet()){ + groupMemberWrapper gMWObj = new groupMemberWrapper(); + gMWObj.personContactId = perContactId; + List committeList = new List(); + for(String committeeName : perConIdVsnewCommitteeName.get(perContactId)){ + committeList.add(new cls_committiees(committeeName)); + } + gMWObj.committiees = committeList; + perConIdVsnewCommitteeNameSTRList.add(JSON.serialize(gMWObj)); + } + EDRD_cls_HandleGroups.handleGroupMembership(perConIdVsOldCommittesNameSTRList, perConIdVsnewCommitteeNameSTRList); + } + +/** +* @author: Deepak +* @date: 20 Dec 2024 +* @description: The purpose of this wrapper is to create JSON for Maps -perConIdVsOldCommittesName & perConIdVsnewCommitteeName. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public class groupMemberWrapper{ + public String personContactId; + public cls_committiees[] committiees; + } + public class cls_committiees { + public String committeeName; + cls_committiees(String committeeName){ + this.committeeName = committeeName; + } + } + public static groupMemberWrapper parse(String json){ + return (groupMemberWrapper) System.JSON.deserialize(json, groupMemberWrapper.class); + } + } \ No newline at end of file diff --git a/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls b/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls index 36fa02a24..c32842bfc 100644 --- a/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls +++ b/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls @@ -4,6 +4,7 @@ * @Description: The purpose of this class is to cover Code coverage of ESA_cls_accountTriggerHandler * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 11 Nov - EDRD-82 - Accenture - Added Close Case method on Account Inactive + 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. ***********************************************************************************************/ @isTest @@ -86,4 +87,12 @@ public class ESA_cls_accountTriggerHandlerTest { Assert.areEqual(caseList.get(0).EDRD_MOHFunding_Expiry_Date__c, System.Today(), 'Date should be Today'); Assert.areNotEqual(caseList.get(0).EDRD_MOHFunding_Expiry_Date__c, NULL, 'Date cannot be Null'); } + +/** +* @author: +* @date: 20 Dec 2024 +* @description: The purpose of this method is to cover Testcoverage of handlePublicGroupMemberships +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + } \ No newline at end of file diff --git a/force-app/main/default/classes/ESA_cls_constants.cls b/force-app/main/default/classes/ESA_cls_constants.cls index c810d8ca0..4df0d714c 100644 --- a/force-app/main/default/classes/ESA_cls_constants.cls +++ b/force-app/main/default/classes/ESA_cls_constants.cls @@ -6,18 +6,26 @@ ***********************************************************************************************/ public class ESA_cls_constants { - + public static final String CASE_APPROVAL_TIME_UNIT_WEEK = 'Weeks'; public static final String CASE_APPROVAL_TIME_UNIT_MONTH = 'Months'; public static final String CASE_APPROVAL_TIME_UNIT_DAYS = 'Days'; - public static final String EDRD_NAME = 'EDRD'; - public static final String EDRD_CASE_STATUS_CANCELLED = 'Cancelled'; + public static final String EDRD_BUSINESS_SC_ACCOUNT = 'Subcommittee'; + public static final String EDRD_BUSINESS_AC_ACCOUNT = 'Advisory Committee'; public static final String EDRD_CASE_CLOSER_REASON_PATIENT_DECEASED = 'Patient Deceased'; public static final String EDRD_CASE_MOHFUNDING_DENIED = 'Denied'; + public static final String EDRD_CASE_STATUS_CANCELLED = 'Cancelled'; public static final String EDRD_CASE_STATUS_FUNDING_APPROVED = 'Funding Approved'; - public static final String EDRD_PROVIDER = 'Provider'; - public static final String EDRD_PRESCRIBER_COMMUNITY_USER = 'EDRD Prescriber Community User'; - public static final String EDRD_PHYSICIAN = 'Physician'; - public static final String EDRD_FUNDING_DECISION_DENIED = 'Denied'; public static final String EDRD_FORMULATION_BOTTLE = 'Bottle'; + public static final String EDRD_FUNDING_DECISION_DENIED = 'Denied'; + public static final String EDRD_NAME = 'EDRD'; + public static final String EDRD_PERSONACCOUNT_SC = 'EDRD Sub Committee'; + public static final String EDRD_PERSONACCOUNT_AC = 'EDRD Advisory Committee'; + public static final String EDRD_PERSONACCOUNT_ACSC = 'EDRD Advisory/ Sub Committee'; + public static final String EDRD_PHYSICIAN = 'Physician'; + public static final String EDRD_PRESCRIBER_COMMUNITY_USER = 'EDRD Prescriber Community User'; + public static final String EDRD_PROVIDER = 'Provider'; + public static final Id PatientRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId(); + public static final String ManullyCreated = 'manullyCreated'; + public static final String EMPICreated = 'EMPICreated'; } \ No newline at end of file diff --git a/force-app/main/default/classes/TestFactory.cls b/force-app/main/default/classes/TestFactory.cls index 0533eab79..2e0d0efa5 100644 --- a/force-app/main/default/classes/TestFactory.cls +++ b/force-app/main/default/classes/TestFactory.cls @@ -538,4 +538,22 @@ public with sharing class TestFactory { ); return cDL; } + + public static Account createEDRDSCAccount(String Name){ + Id committeeRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('EDRD_Committee').getRecordTypeId(); + Account accountObj = new Account(); + accountObj.Name = Name; + accountObj.RecordTypeId = committeeRecordTypeId; + accountObj.EDRD_Committee_Type__c = 'Subcommittee'; + return accountObj; + } + + public static Account createEDRDACAccount(String Name){ + Id committeeRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('EDRD_Committee').getRecordTypeId(); + Account accountObj = new Account(); + accountObj.Name = Name; + accountObj.RecordTypeId = committeeRecordTypeId; + accountObj.EDRD_Committee_Type__c = 'Advisory Committee'; + return accountObj; + } } \ No newline at end of file diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml new file mode 100644 index 000000000..549ccaec5 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + + + + EDRD_Public_Group_Name__c + EDRD_Advisory_Committee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cardiac_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cardiac_Subcommittee.md-meta.xml new file mode 100644 index 000000000..fe6824b44 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cardiac_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Cardiac Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Cardiac_Clinical_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cystic_Fibrosis_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cystic_Fibrosis_Subcommittee.md-meta.xml new file mode 100644 index 000000000..6716195f1 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Cystic_Fibrosis_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Cystic Fibrosis Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Cystic_Fibrosis_Mutation_CFM_Subc + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Hematology_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Hematology_Subcommittee.md-meta.xml new file mode 100644 index 000000000..d89148edf --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Hematology_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Hematology Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Hematology_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Immunology_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Immunology_Subcommittee.md-meta.xml new file mode 100644 index 000000000..a239d4436 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Immunology_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Immunology Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Immunology_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Metabolic_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Metabolic_Subcommittee.md-meta.xml new file mode 100644 index 000000000..14e1ef57c --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Metabolic_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Metabolic Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Metabolic_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Nephrology_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Nephrology_Subcommittee.md-meta.xml new file mode 100644 index 000000000..cbb0846b5 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Nephrology_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Nephrology Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Nephrology_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Neurology_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Neurology_Subcommittee.md-meta.xml new file mode 100644 index 000000000..9ea9104f5 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Neurology_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Neurology Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Neurological_Disorders_Subcommittee + + diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Ophthalmology_Subcommittee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Ophthalmology_Subcommittee.md-meta.xml new file mode 100644 index 000000000..7801d5e76 --- /dev/null +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Ophthalmology_Subcommittee.md-meta.xml @@ -0,0 +1,13 @@ + + + + false + + Committee_Name__c + Ophthalmology Subcommittee + + + EDRD_Public_Group_Name__c + EDRD_Ophthalmology_Subcommittee + + diff --git a/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/EDRD_Public_Grp_vs_Committee__mdt.object-meta.xml b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/EDRD_Public_Grp_vs_Committee__mdt.object-meta.xml new file mode 100644 index 000000000..9eea0a000 --- /dev/null +++ b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/EDRD_Public_Grp_vs_Committee__mdt.object-meta.xml @@ -0,0 +1,6 @@ + + + + EDRD Public Grp vs Committees + Public + diff --git a/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/Committee_Name__c.field-meta.xml b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/Committee_Name__c.field-meta.xml new file mode 100644 index 000000000..7adc919b3 --- /dev/null +++ b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/Committee_Name__c.field-meta.xml @@ -0,0 +1,11 @@ + + + Committee_Name__c + false + DeveloperControlled + + 255 + false + Text + false + diff --git a/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/EDRD_Public_Group_Name__c.field-meta.xml b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/EDRD_Public_Group_Name__c.field-meta.xml new file mode 100644 index 000000000..bb0a3248c --- /dev/null +++ b/force-app/main/default/objects/EDRD_Public_Grp_vs_Committee__mdt/fields/EDRD_Public_Group_Name__c.field-meta.xml @@ -0,0 +1,11 @@ + + + EDRD_Public_Group_Name__c + false + DeveloperControlled + + 255 + false + Text + false + diff --git a/force-app/main/default/triggers/AccountContactRelationTrigger.trigger b/force-app/main/default/triggers/AccountContactRelationTrigger.trigger index 73922888e..755dfba33 100644 --- a/force-app/main/default/triggers/AccountContactRelationTrigger.trigger +++ b/force-app/main/default/triggers/AccountContactRelationTrigger.trigger @@ -3,11 +3,15 @@ * @Date: 21 Aug 2024 * @Description: The purpose of this Trigger is to trigger on particular events * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] + 21 Aug - EDRD-911 - Accenture - Added Patient Share/delete With Provider User + 13 Dec - EDRD-1150 - Accenture - The purpose of this method is to update Committee based on ACR insert of EDRD_Committee & Provider OR Committee_Reviewer. + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. ***********************************************************************************************/ trigger AccountContactRelationTrigger on AccountContactRelation (after insert, after update, after delete) { if(trigger.isInsert && trigger.isAfter){ AccountContactRelationTriggerHandler.createPatientShare(trigger.new); + AccountContactRelationTriggerHandler.updateCommitteeFieldOnACRInsert(trigger.new); } if(trigger.isUpdate && trigger.isAfter){ @@ -15,6 +19,7 @@ trigger AccountContactRelationTrigger on AccountContactRelation (after insert, a } if(trigger.isDelete && trigger.isAfter){ + AccountContactRelationTriggerHandler.removeCommitteeFieldOnACRDelete(trigger.old); AccountContactRelationTriggerHandler.removePatientShare(trigger.old); } diff --git a/force-app/main/default/triggers/ESA_tgr_accountTrigger.trigger b/force-app/main/default/triggers/ESA_tgr_accountTrigger.trigger index 16a945da8..8aa4d3eb4 100644 --- a/force-app/main/default/triggers/ESA_tgr_accountTrigger.trigger +++ b/force-app/main/default/triggers/ESA_tgr_accountTrigger.trigger @@ -4,6 +4,7 @@ * @Description: The purpose of this Trigger is to trigger on particular events * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 11 Nov - EDRD-82 - Accenture - Added Close Case method on Account Inactive + 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. ***********************************************************************************************/ trigger ESA_tgr_accountTrigger on account (after insert, after update) { @@ -15,6 +16,7 @@ trigger ESA_tgr_accountTrigger on account (after insert, after update) { if(trigger.isUpdate){ ESA_cls_accountTriggerHandler.populateSpecialty(trigger.new, trigger.newMap, trigger.oldMap); ESA_cls_accountTriggerHandler.closeCaseOnAccDeceased(trigger.new, trigger.oldMap, trigger.newMap); + ESA_cls_accountTriggerHandler.handlePublicGroupMemberships(trigger.oldMap, trigger.newMap); } } } \ No newline at end of file From 76c75e3f69d97e26f595dcb1bb95e1e4cc26cc11 Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Mon, 23 Dec 2024 09:13:59 -0500 Subject: [PATCH 02/12] Change-1 --- force-app/main/default/classes/EDRD_cls_HandleGroups.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls index f345b767d..864ff3cba 100644 --- a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls @@ -5,7 +5,7 @@ * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. ***********************************************************************************************/ -public without Sharing class EDRD_cls_HandleGroups { +public with Sharing class EDRD_cls_HandleGroups { /** * @author: Deepak From 32c19ca0c1b07ca972943d65a74b05cb37229677 Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Mon, 23 Dec 2024 10:21:41 -0500 Subject: [PATCH 03/12] Change -2 --- ...countContactRelationTriggerHandlerTest.cls | 68 +++++++++---------- .../default/classes/ESA_cls_constants.cls | 8 ++- 2 files changed, 40 insertions(+), 36 deletions(-) diff --git a/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls b/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls index b6c9a15b4..57795a0fc 100644 --- a/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls +++ b/dev-app-post/main/default/classes/AccountContactRelationTriggerHandlerTest.cls @@ -138,37 +138,37 @@ public class AccountContactRelationTriggerHandlerTest { public static void updateCommitteeFieldOnACRInsertTest(){ List providerList = new List(); Account providerAcc = TestFactory.newProvider('Provider'); - providerAcc.Provider_Type__pc = 'Physician'; + providerAcc.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerList.add(providerAcc); Account providerAcc2 = TestFactory.newProvider('Provider2'); providerAcc2.Provider_Identifier__pc = '111222'; - providerAcc2.Provider_Type__pc = 'Physician'; + providerAcc2.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerList.add(providerAcc2); Account providerAcc3 = TestFactory.newProvider('Provider3'); - providerAcc3.Committee__pc = 'EDRD Sub Committee'; - providerAcc3.Committee_Name__pc = 'Metabolic Subcommittee'; + providerAcc3.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAcc3.Committee_Name__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE; providerAcc3.Provider_Identifier__pc = '1112223'; - providerAcc3.Provider_Type__pc = 'Physician'; + providerAcc3.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerList.add(providerAcc3); Account providerAcc4 = TestFactory.newProvider('Provider4'); - providerAcc4.Committee__pc = 'EDRD Advisory Committee'; + providerAcc4.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_AC; providerAcc4.Provider_Identifier__pc = '1112224'; - providerAcc4.Provider_Type__pc = 'Physician'; + providerAcc4.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerList.add(providerAcc4); Account providerAcc5 = TestFactory.newProvider('Provider5'); - providerAcc5.Committee__pc = 'EDRD Advisory/ Sub Committee'; + providerAcc5.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; providerAcc5.Committee_Name__pc = 'Cystic Fibrosis Subcommittee;Ophthalmology Subcommittee'; providerAcc5.Provider_Identifier__pc = '1112225'; - providerAcc5.Provider_Type__pc = 'Physician'; + providerAcc5.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerList.add(providerAcc5); insert providerList; List committeeList = new List(); - Account sCBusinessAcc = TestFactory.createEDRDSCAccount('Metabolic Subcommittee'); + Account sCBusinessAcc = TestFactory.createEDRDSCAccount(ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE); committeeList.add(sCBusinessAcc); Account sCBusinessAcc1 = TestFactory.createEDRDSCAccount('Cardiac Subcommittee'); committeeList.add(sCBusinessAcc1); - Account aCBusinessAcc = TestFactory.createEDRDACAccount('EDRD Advisory Committee'); + Account aCBusinessAcc = TestFactory.createEDRDACAccount(ESA_cls_constants.EDRD_PERSONACCOUNT_AC); committeeList.add(aCBusinessAcc); insert committeeList; @@ -177,46 +177,46 @@ public class AccountContactRelationTriggerHandlerTest { AccountContactRelation ACRObj = new AccountContactRelation(); ACRObj.AccountId = sCBusinessAcc.Id; ACRObj.ContactId = providerContactId; - ACRObj.Roles = 'Reviewer'; + ACRObj.Roles = ESA_cls_constants.EDRD_ACR_ROLES_REVIEWER; aCRListTOInsert.add(ACRObj); Id provider2ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc2.Id].get(0).Id; AccountContactRelation ACRObj2 = new AccountContactRelation(); ACRObj2.AccountId = aCBusinessAcc.Id; ACRObj2.ContactId = provider2ContactId; - ACRObj2.Roles = 'Chair'; + ACRObj2.Roles = ESA_cls_constants.EDRD_ACR_ROLES_CHAIR; aCRListTOInsert.add(ACRObj2); Id provider3ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc3.Id].get(0).Id; AccountContactRelation ACRObj3 = new AccountContactRelation(); ACRObj3.AccountId = aCBusinessAcc.Id; ACRObj3.ContactId = provider3ContactId; - ACRObj3.Roles = 'Vice Chair'; + ACRObj3.Roles = ESA_cls_constants.EDRD_ACR_ROLES_VICE_CHAIR; aCRListTOInsert.add(ACRObj3); Id provider4ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc4.Id].get(0).Id; AccountContactRelation ACRObj4 = new AccountContactRelation(); ACRObj4.AccountId = sCBusinessAcc1.Id; ACRObj4.ContactId = provider4ContactId; - ACRObj4.Roles = 'Vice Chair'; + ACRObj4.Roles = ESA_cls_constants.EDRD_ACR_ROLES_VICE_CHAIR; aCRListTOInsert.add(ACRObj4); Id provider5ContactId = [SELECT Id FROM Contact Where accountId =: providerAcc5.Id].get(0).Id; AccountContactRelation ACRObj5 = new AccountContactRelation(); ACRObj5.AccountId = sCBusinessAcc1.Id; ACRObj5.ContactId = provider5ContactId; - ACRObj5.Roles = 'Chair'; + ACRObj5.Roles = ESA_cls_constants.EDRD_ACR_ROLES_CHAIR; aCRListTOInsert.add(ACRObj5); AccountContactRelation ACRObj6 = new AccountContactRelation(); ACRObj6.AccountId = sCBusinessAcc1.Id; ACRObj6.ContactId = provider3ContactId; - ACRObj6.Roles = 'Reviewer'; + ACRObj6.Roles = ESA_cls_constants.EDRD_ACR_ROLES_REVIEWER; aCRListTOInsert.add(ACRObj6); AccountContactRelation ACRObj7 = new AccountContactRelation(); ACRObj7.AccountId = aCBusinessAcc.Id; ACRObj7.ContactId = provider4ContactId; - ACRObj7.Roles = 'Chair'; + ACRObj7.Roles = ESA_cls_constants.EDRD_ACR_ROLES_CHAIR; aCRListTOInsert.add(ACRObj7); AccountContactRelation ACRObj8 = new AccountContactRelation(); ACRObj8.AccountId = aCBusinessAcc.Id; ACRObj8.ContactId = provider5ContactId; - ACRObj8.Roles = 'Vice Chair'; + ACRObj8.Roles = ESA_cls_constants.EDRD_ACR_ROLES_VICE_CHAIR; aCRListTOInsert.add(ACRObj8); Test.startTest(); @@ -227,16 +227,16 @@ public class AccountContactRelationTriggerHandlerTest { WHERE Id IN (:providerAcc.Id, :providerAcc2.Id, :providerAcc3.Id)]); Account updatedProviderAccount = updatedProviders.get(providerAcc.Id); - Assert.areEqual(updatedProviderAccount.Committee__pc, 'EDRD Sub Committee', 'Provider Record should be updated'); + Assert.areEqual(updatedProviderAccount.Committee__pc, ESA_cls_constants.EDRD_PERSONACCOUNT_SC, 'Provider Record should be updated'); Assert.areNotEqual(updatedProviderAccount.Committee_Name__pc, NULL, 'Committee_Name__pc on provider field should not be NULL'); Assert.areEqual(updatedProviderAccount.Committee_Name__pc, 'Metabolic Subcommittee', 'Provider Committee_Name__pc should be updated'); Account updatedProviderAccount2 = updatedProviders.get(providerAcc2.Id); - Assert.areEqual(updatedProviderAccount2.Committee__pc, 'EDRD Advisory Committee','Provider Record should be updated'); + Assert.areEqual(updatedProviderAccount2.Committee__pc, ESA_cls_constants.EDRD_PERSONACCOUNT_AC,'Provider Record should be updated'); Assert.areEqual(updatedProviderAccount2.Committee_Name__pc, NULL, 'Provider2 Committee_Name__pc should be NULL'); Account updatedProviderAccount3 = updatedProviders.get(providerAcc3.Id); - Assert.areEqual(updatedProviderAccount3.Committee__pc, 'EDRD Advisory/ Sub Committee', 'Provider3 Record should be updated'); + Assert.areEqual(updatedProviderAccount3.Committee__pc, ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC, 'Provider3 Record should be updated'); Assert.areNotEqual(updatedProviderAccount3.Committee_Name__pc, NULL, 'Committee_Name__pc on provider3 field should not be NULL'); Assert.areEqual(updatedProviderAccount3.Committee_Name__pc, 'Cardiac Subcommittee;Metabolic Subcommittee', 'Provider Committee_Name__pc should be updated'); } @@ -251,24 +251,24 @@ public class AccountContactRelationTriggerHandlerTest { public static void removeCommitteeFieldOnACRDeleteTest(){ List providerAccList = new List(); Account provider = TestFactory.newProvider('Provider'); - provider.Provider_Type__pc = 'Physician'; + provider.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerAccList.add(provider); Account provider2 = TestFactory.newProvider('Provider2'); provider2.Provider_Identifier__pc = '111222'; - provider2.Provider_Type__pc = 'Physician'; + provider2.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerAccList.add(provider2); Account provider3 = TestFactory.newProvider('Provider3'); - provider3.Committee__pc = 'EDRD Sub Committee'; - provider3.Committee_Name__pc = 'Metabolic Subcommittee'; + provider3.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + provider3.Committee_Name__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE; provider3.Provider_Identifier__pc = '1112223'; - provider3.Provider_Type__pc = 'Physician'; + provider3.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; providerAccList.add(provider3); insert providerAccList; List committeeList = new List(); - Account sCBusinessAcc = TestFactory.createEDRDSCAccount('Metabolic Subcommittee'); + Account sCBusinessAcc = TestFactory.createEDRDSCAccount(ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE); committeeList.add(sCBusinessAcc); - Account aCBusinessAcc = TestFactory.createEDRDACAccount('EDRD Advisory Committee'); + Account aCBusinessAcc = TestFactory.createEDRDACAccount(ESA_cls_constants.EDRD_PERSONACCOUNT_AC); committeeList.add(aCBusinessAcc); insert committeeList; @@ -277,19 +277,19 @@ public class AccountContactRelationTriggerHandlerTest { AccountContactRelation ACRObj = new AccountContactRelation(); ACRObj.AccountId = sCBusinessAcc.Id; ACRObj.ContactId = providerContactId; - ACRObj.Roles = 'Reviewer'; + ACRObj.Roles = ESA_cls_constants.EDRD_ACR_ROLES_REVIEWER; aCRListTOInsert.add(ACRObj); Id provider2ContactId = [SELECT Id FROM Contact Where accountId =: provider2.Id].get(0).Id; AccountContactRelation ACRObj2 = new AccountContactRelation(); ACRObj2.AccountId = aCBusinessAcc.Id; ACRObj2.ContactId = provider2ContactId; - ACRObj2.Roles = 'Chair'; + ACRObj2.Roles = ESA_cls_constants.EDRD_ACR_ROLES_CHAIR; aCRListTOInsert.add(ACRObj2); Id provider3ContactId = [SELECT Id FROM Contact Where accountId =: provider3.Id].get(0).Id; AccountContactRelation ACRObj3 = new AccountContactRelation(); ACRObj3.AccountId = aCBusinessAcc.Id; ACRObj3.ContactId = provider3ContactId; - ACRObj3.Roles = 'Vice Chair'; + ACRObj3.Roles = ESA_cls_constants.EDRD_ACR_ROLES_VICE_CHAIR; aCRListTOInsert.add(ACRObj3); insert aCRListTOInsert; @@ -301,8 +301,8 @@ public class AccountContactRelationTriggerHandlerTest { WHERE Id IN :new Set{provider2.Id, provider3.Id}]); Account provider3AfterDelete = accountMap.get(provider3.Id); - Assert.areEqual(provider3AfterDelete.Committee__pc, 'EDRD Sub Committee', 'Committee should be null after deletion'); - Assert.areEqual(provider3AfterDelete.Committee_Name__pc, 'Metabolic Subcommittee', 'Committee Name should be null after deletion'); + Assert.areEqual(provider3AfterDelete.Committee__pc, ESA_cls_constants.EDRD_PERSONACCOUNT_SC, 'Committee should be null after deletion'); + Assert.areEqual(provider3AfterDelete.Committee_Name__pc, ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE, 'Committee Name should be null after deletion'); Assert.areNotEqual(provider3AfterDelete.Committee__pc, NULL, 'Committee should not be null after deletion'); Assert.areNotEqual(provider3AfterDelete.Committee_Name__pc, NULL, 'Committee Name should not be null after deletion'); diff --git a/force-app/main/default/classes/ESA_cls_constants.cls b/force-app/main/default/classes/ESA_cls_constants.cls index 4df0d714c..11b3f0095 100644 --- a/force-app/main/default/classes/ESA_cls_constants.cls +++ b/force-app/main/default/classes/ESA_cls_constants.cls @@ -10,6 +10,9 @@ public class ESA_cls_constants { public static final String CASE_APPROVAL_TIME_UNIT_WEEK = 'Weeks'; public static final String CASE_APPROVAL_TIME_UNIT_MONTH = 'Months'; public static final String CASE_APPROVAL_TIME_UNIT_DAYS = 'Days'; + public static final String EDRD_ACR_ROLES_CHAIR = 'Chair'; + public static final String EDRD_ACR_ROLES_REVIEWER = 'Reviewer'; + public static final String EDRD_ACR_ROLES_VICE_CHAIR = 'Vice Chair'; //ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE public static final String EDRD_BUSINESS_SC_ACCOUNT = 'Subcommittee'; public static final String EDRD_BUSINESS_AC_ACCOUNT = 'Advisory Committee'; public static final String EDRD_CASE_CLOSER_REASON_PATIENT_DECEASED = 'Patient Deceased'; @@ -19,7 +22,8 @@ public class ESA_cls_constants { public static final String EDRD_FORMULATION_BOTTLE = 'Bottle'; public static final String EDRD_FUNDING_DECISION_DENIED = 'Denied'; public static final String EDRD_NAME = 'EDRD'; - public static final String EDRD_PERSONACCOUNT_SC = 'EDRD Sub Committee'; + public static final String EDRD_PERSONACCOUNT_SC = 'EDRD Sub Committee'; + public static final String EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE = 'Metabolic Subcommittee'; public static final String EDRD_PERSONACCOUNT_AC = 'EDRD Advisory Committee'; public static final String EDRD_PERSONACCOUNT_ACSC = 'EDRD Advisory/ Sub Committee'; public static final String EDRD_PHYSICIAN = 'Physician'; @@ -27,5 +31,5 @@ public class ESA_cls_constants { public static final String EDRD_PROVIDER = 'Provider'; public static final Id PatientRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId(); public static final String ManullyCreated = 'manullyCreated'; - public static final String EMPICreated = 'EMPICreated'; + public static final String EMPICreated = 'EMPICreated'; } \ No newline at end of file From dfab53ac0159ac6432342a049cf17261cddd2b0c Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Mon, 23 Dec 2024 10:32:23 -0500 Subject: [PATCH 04/12] Change-3 --- force-app/main/default/classes/ESA_cls_constants.cls | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/force-app/main/default/classes/ESA_cls_constants.cls b/force-app/main/default/classes/ESA_cls_constants.cls index 11b3f0095..93e2262e6 100644 --- a/force-app/main/default/classes/ESA_cls_constants.cls +++ b/force-app/main/default/classes/ESA_cls_constants.cls @@ -12,7 +12,7 @@ public class ESA_cls_constants { public static final String CASE_APPROVAL_TIME_UNIT_DAYS = 'Days'; public static final String EDRD_ACR_ROLES_CHAIR = 'Chair'; public static final String EDRD_ACR_ROLES_REVIEWER = 'Reviewer'; - public static final String EDRD_ACR_ROLES_VICE_CHAIR = 'Vice Chair'; //ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE + public static final String EDRD_ACR_ROLES_VICE_CHAIR = 'Vice Chair'; public static final String EDRD_BUSINESS_SC_ACCOUNT = 'Subcommittee'; public static final String EDRD_BUSINESS_AC_ACCOUNT = 'Advisory Committee'; public static final String EDRD_CASE_CLOSER_REASON_PATIENT_DECEASED = 'Patient Deceased'; @@ -29,7 +29,7 @@ public class ESA_cls_constants { public static final String EDRD_PHYSICIAN = 'Physician'; public static final String EDRD_PRESCRIBER_COMMUNITY_USER = 'EDRD Prescriber Community User'; public static final String EDRD_PROVIDER = 'Provider'; - public static final Id PatientRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByName().get('Patient').getRecordTypeId(); + public static final Id PatientRecordTypeId = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get('Patient').getRecordTypeId(); public static final String ManullyCreated = 'manullyCreated'; public static final String EMPICreated = 'EMPICreated'; } \ No newline at end of file From 801cb80ced79492bd3335258d6acb6f7d5e41d41 Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Wed, 8 Jan 2025 05:39:44 -0500 Subject: [PATCH 05/12] Changes related to EDRD-1150 --- .../classes/EDRD_cls_HandleGroupsTest.cls | 43 ++++++++++ .../EDRD_cls_HandleGroupsTest.cls-meta.xml | 0 .../ESA_cls_accountTriggerHandlerTest.cls | 29 ++++++- ...cls_accountTriggerHandlerTest.cls-meta.xml | 0 .../classes/UserTriggerHandlerTest.cls | 31 +++++++ .../AccountContactRelationTriggerHandler.cls | 4 +- .../default/classes/EDRD_cls_HandleGroups.cls | 12 +-- .../classes/EDRD_cls_HandleGroupsTest.cls | 18 ---- .../classes/ESA_cls_accountTriggerHandler.cls | 85 +++++++++++++------ .../default/classes/ESA_cls_constants.cls | 1 + .../default/classes/UserTriggerHandler.cls | 78 +++++++++++++++++ ...mittee.EDRD_Advisory_Committee.md-meta.xml | 2 +- .../main/default/triggers/UserTrigger.trigger | 3 + 13 files changed, 250 insertions(+), 56 deletions(-) create mode 100644 dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls rename {force-app => dev-app-post}/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml (100%) rename {force-app => dev-app-post}/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls (78%) rename {force-app => dev-app-post}/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls-meta.xml (100%) delete mode 100644 force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls diff --git a/dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls b/dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls new file mode 100644 index 000000000..019e5acb7 --- /dev/null +++ b/dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls @@ -0,0 +1,43 @@ +/********************************************************************************************** +* @Author: Accenture +* @Date: 20/12/2024 +* @Description: The purpose of this class is to cover Code coverage of EDRD_cls_HandleGroups +* @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] + 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. +***********************************************************************************************/ +@isTest +public class EDRD_cls_HandleGroupsTest { + +/** +* @author: +* @date: 23 Dec 2024 +* @description: The purpose of this method is to cover Testcoverage of handleGroupMembership +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @isTest + public static void handleGroupMembershipTest(){ + Account providerAcc = TestFactory.newProvider('Provider Test'); + providerAcc.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAcc.Committee_Name__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE; + providerAcc.Provider_Identifier__pc = '1112223'; + providerAcc.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; + insert providerAcc; + + Id ContactId = [SELECT Id FROM Contact WHERE AccountID =: providerAcc.Id].get(0).Id; + Profile profileRec = [SELECT Id FROM Profile WHERE Name = 'EDRD Prescriber Community User']; + User communityUser = TestFactory.createCommunityUser(ContactId, profileRec.Id, 'Test1', 'Test'); + insert communityUser; + + providerAcc.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + + Test.startTest(); + update providerAcc; + Test.stopTest(); + + List groupMembers = [SELECT Id, GroupId FROM GroupMember WHERE UserOrGroupId = :communityUser.Id]; + + Assert.areEqual(TRUE, groupMembers.size() > 0, 'At least one GroupMember should exist for the user'); + Assert.areEqual(2, groupMembers.size(), 'Exactly two GroupMember should exist for the user'); + Assert.areNotEqual(null, groupMembers[0].GroupId, 'GroupMember should have a valid GroupId'); + } +} \ No newline at end of file diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml b/dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml similarity index 100% rename from force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml rename to dev-app-post/main/default/classes/EDRD_cls_HandleGroupsTest.cls-meta.xml diff --git a/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls b/dev-app-post/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls similarity index 78% rename from force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls rename to dev-app-post/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls index c32842bfc..43081c9ca 100644 --- a/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls +++ b/dev-app-post/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls @@ -89,10 +89,35 @@ public class ESA_cls_accountTriggerHandlerTest { } /** -* @author: +* @author: Deepak * @date: 20 Dec 2024 * @description: The purpose of this method is to cover Testcoverage of handlePublicGroupMemberships * @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] */ - + @isTest + public static void handlePublicGroupMembershipsTest(){ + Account providerAccount = TestFactory.newProvider('Provider Test'); + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAccount.Committee_Name__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE; + providerAccount.Provider_Identifier__pc = '1112223'; + providerAccount.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; + insert providerAccount; + + Id ContactId = [SELECT Id FROM Contact WHERE AccountID =: providerAccount.Id].get(0).Id; + Profile profileRec = [SELECT Id FROM Profile WHERE Name = 'EDRD Prescriber Community User']; + User communityReviewer = TestFactory.createCommunityUser(ContactId, profileRec.Id, 'Test1', 'Test'); + insert communityReviewer; + + providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_ACSC; + + Test.startTest(); + update providerAccount; + Test.stopTest(); + + List groupMembersList = [SELECT Id, GroupId FROM GroupMember WHERE UserOrGroupId = :communityReviewer.Id]; + + Assert.areEqual(TRUE, groupMembersList.size() > 0, 'At least one GroupMember should exist for the user'); + Assert.areEqual(2, groupMembersList.size(), 'Exactly two GroupMember should exist for the user'); + Assert.areNotEqual(null, groupMembersList[0].GroupId, 'GroupMember should have a valid GroupId'); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls-meta.xml b/dev-app-post/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls-meta.xml similarity index 100% rename from force-app/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls-meta.xml rename to dev-app-post/main/default/classes/ESA_cls_accountTriggerHandlerTest.cls-meta.xml diff --git a/dev-app-post/main/default/classes/UserTriggerHandlerTest.cls b/dev-app-post/main/default/classes/UserTriggerHandlerTest.cls index abdf32a10..de501b4af 100644 --- a/dev-app-post/main/default/classes/UserTriggerHandlerTest.cls +++ b/dev-app-post/main/default/classes/UserTriggerHandlerTest.cls @@ -4,6 +4,7 @@ * @Description: The purpose of this class is to cover Code coverage of UserTriggerHandler * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 24Sept - EDRD-911 - Deepak - Added activateACROnEDRDPortalEnable_Test method + 07Jan - EDRD-1150 - Accenture - Added handleEDRDPublicGroupMemberTest method ***********************************************************************************************/ @isTest public class UserTriggerHandlerTest { @@ -57,4 +58,34 @@ public class UserTriggerHandlerTest { Assert.areNotEqual(accShareList1.isEmpty(), true, 'AccountShare list should not be empty'); Assert.areNotEqual(accShareList1[0].UserOrGroupId, null, 'UserOrGroupId should not be null'); } + +/** +* @author: Deepak +* @date: 07 Jan 2025 +* @description: The purpose of this method is to cover Testcoverage of handleEDRDPublicGroupMember & handleGroupsForUsersAsync +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @isTest + public static void handleEDRDPublicGroupMemberTest(){ + Account providerAcc = TestFactory.newProvider('Provider Test'); + providerAcc.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; + providerAcc.Committee_Name__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC_METABOLIC_SUBCOMMITTEE; + providerAcc.Provider_Identifier__pc = '1112223'; + providerAcc.Provider_Type__pc = ESA_cls_constants.EDRD_PHYSICIAN; + insert providerAcc; + + Id ContactId = [SELECT Id FROM Contact WHERE AccountID =: providerAcc.Id].get(0).Id; + Profile profileRec = [SELECT Id FROM Profile WHERE Name = 'EDRD Prescriber Community User']; + User communityUser = TestFactory.createCommunityUser(ContactId, profileRec.Id, 'Test1', 'Test'); + + Test.startTest(); + insert communityUser; + Test.stopTest(); + + List groupMembers = [SELECT Id, GroupId, UserOrGroupId FROM GroupMember WHERE UserOrGroupId = :communityUser.Id]; + + Assert.areEqual(TRUE, groupMembers.size() > 0, 'At least one GroupMember should be created for the community user.'); + Assert.areEqual(1, groupMembers.size(), 'Exactly one GroupMember should be created for the community user.'); + Assert.areNotEqual(null, groupMembers[0].GroupId, 'GroupMember should have a valid GroupId.'); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls b/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls index b8188b63d..eb45a1e75 100644 --- a/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls +++ b/force-app/main/default/classes/AccountContactRelationTriggerHandler.cls @@ -144,7 +144,7 @@ public with sharing class AccountContactRelationTriggerHandler { if(accRecTypeSet.Contains(businessAccount.RecordType.DeveloperName) || (accRecTypeSet.Contains(providerAccount.RecordType.DeveloperName))){ String businessCommitteeTypes = businessAccount.EDRD_Committee_Type__c; String oldProviderCommittee = providerAccount.Committee__pc; - + if (ESA_cls_constants.EDRD_BUSINESS_SC_ACCOUNT.equalsIgnoreCase(businessCommitteeTypes) && oldProviderCommittee == NULL) { providerAccount.Committee__pc = ESA_cls_constants.EDRD_PERSONACCOUNT_SC; providerAccount.Committee_Name__pc = providerAccount.Committee_Name__pc != NULL ? providerAccount.Committee_Name__pc +';'+ businessAccount.Name : businessAccount.Name; @@ -238,7 +238,7 @@ public with sharing class AccountContactRelationTriggerHandler { providerIdVsRecToUpdate.put(providerAccount.Id, new Account(Id = providerAccount.Id, Committee__pc = providerAccount.Committee__pc, Committee_Name__pc = providerAccount.Committee_Name__pc)); } } - + if (!providerIdVsRecToUpdate.isEmpty()) { Database.update(providerIdVsRecToUpdate.values(), true); } diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls index 864ff3cba..842c48faa 100644 --- a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls @@ -3,9 +3,9 @@ * @Date: 09 Mar 2023 * @Description: The purpose of this class is to Adding/Removing - Provider/Reviewer to public groups in without sharing context. * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] - 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees. + 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees ***********************************************************************************************/ -public with Sharing class EDRD_cls_HandleGroups { +public without Sharing class EDRD_cls_HandleGroups { /** * @author: Deepak @@ -63,7 +63,7 @@ public with Sharing class EDRD_cls_HandleGroups { List userListToDelete = [SELECT Id, ContactId FROM User WHERE ContactId IN: perConIdVsOldGroupName.keySet()]; for(Group grpObj: groupList){ - groupNameVsGroupId.put(grpObj.Name, grpObj.Id); + groupNameVsGroupId.put(grpObj.DeveloperName, grpObj.Id); } Map groupIdVsUserGroupId = new Map(); for(User userObj: userListToDelete){ @@ -78,14 +78,14 @@ public with Sharing class EDRD_cls_HandleGroups { delete groupMemberToDelete; } } - + for(Id perContactId :perConIdVsnewCommitteeName.KeySet()){ for(String committeeName: perConIdVsnewCommitteeName.get(perContactId)){ if(!perConIdVsNewGroupName.containsKey(perContactId)){ perConIdVsNewGroupName.put(perContactId, new Set()); } - perConIdVsNewGroupName.get(perContactId).add(committeeToGroupMap.get(committeeName)); + perConIdVsNewGroupName.get(perContactId).add(committeeToGroupMap.get(committeeName)); } } @@ -97,7 +97,9 @@ public with Sharing class EDRD_cls_HandleGroups { for(User userObj: userList){ for(String groupName: perConIdVsNewGroupName.get(userObj.ContactId)){ + if(groupNameVsGroupId.get(groupName) != NULL){ groupMemberToInsert.add(new GroupMember(groupId = groupNameVsGroupId.get(groupName), UserOrGroupId = userObj.Id)); + } } } diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls b/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls deleted file mode 100644 index 3f365279f..000000000 --- a/force-app/main/default/classes/EDRD_cls_HandleGroupsTest.cls +++ /dev/null @@ -1,18 +0,0 @@ -/********************************************************************************************** -* @Author: Accenture -* @Date: 20/12/2024 -* @Description: The purpose of this class is to cover Code coverage of EDRD_cls_HandleGroups -* @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] - 20 Dec - EDRD-1150 - Accenture - The purpose of this method is to Remove Committee based on ACR delete of EDRD_Committee & Provider OR Committee_Reviewer. -***********************************************************************************************/ -@isTest -public class EDRD_cls_HandleGroupsTest { - -/** -* @author: -* @date: 23 Dec 2024 -* @description: The purpose of this method is to cover Testcoverage of handleGroupMembership -* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] -*/ - -} \ No newline at end of file diff --git a/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls b/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls index 913d3ede7..8a9882d83 100644 --- a/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls +++ b/force-app/main/default/classes/ESA_cls_accountTriggerHandler.cls @@ -97,46 +97,75 @@ public with sharing class ESA_cls_accountTriggerHandler { public static void handlePublicGroupMemberships(Map oldAccountMap, Map newAccountMap) { Map> perConIdVsOldCommittesName = new Map>(); Map> perConIdVsnewCommitteeName = new Map>(); + List perConIdVsOldCommittesNameSTRList = new List(); + List perConIdVsnewCommitteeNameSTRList = new List(); Map accNameVsPerConId = new Map(); for (Id accountId : newAccountMap.keySet()) { Account oldAccount = oldAccountMap.get(accountId); Account newAccount = newAccountMap.get(accountId); + if(oldAccount.Committee__pc == newAccount.Committee__pc && oldAccount.Committee_Name__pc == newAccount.Committee_Name__pc){ + continue; + } accNameVsPerConId.put(newAccount.Name, newAccount.PersonContactId); - if (oldAccount.Committee__pc != null && oldAccount.Committee_Name__pc != null) { - perConIdVsOldCommittesName.put(oldAccount.perSonContactId, new Set(oldAccount.Committee_Name__pc.split(';'))); + if(oldAccount.Committee_Name__pc != newAccount.Committee_Name__pc){ + if (oldAccount.Committee_Name__pc != null) { + perConIdVsOldCommittesName.put(oldAccount.perSonContactId, new Set(oldAccount.Committee_Name__pc.split(';'))); + } + if (newAccount.Committee_Name__pc != null) { + perConIdVsnewCommitteeName.put(newAccount.perSonContactId, new Set(newAccount.Committee_Name__pc.split(';'))); + } } - if (newAccount.Committee__pc != null && newAccount.Committee_Name__pc != null) { - perConIdVsnewCommitteeName.put(newAccount.perSonContactId, new Set(newAccount.Committee_Name__pc.split(';'))); + if(oldAccount.Committee__pc != newAccount.Committee__pc){ + if(!perConIdVsOldCommittesName.containsKey(oldAccount.perSonContactId)){ + perConIdVsOldCommittesName.put(oldAccount.perSonContactId, new Set()); + } + if(!perConIdVsnewCommitteeName.containsKey(newAccount.perSonContactId)){ + perConIdVsnewCommitteeName.put(newAccount.perSonContactId, new Set()); + } + if (oldAccount.Committee__pc != null) { + String committeeName = (oldAccount.Committee__pc == 'EDRD Advisory/ Sub Committee') ? 'EDRD Advisory Committee' : oldAccount.Committee__pc; + perConIdVsOldCommittesName.get(oldAccount.perSonContactId).add(committeeName); + } + if (newAccount.Committee__pc != null) { + perConIdVsnewCommitteeName.get(newAccount.perSonContactId).addAll(newAccount.Committee__pc.split(';')); + } } - } - List perConIdVsOldCommittesNameSTRList = new List(); - - for(Id perContactId: perConIdVsOldCommittesName.keySet()){ - groupMemberWrapper gMWObj = new groupMemberWrapper(); - gMWObj.personContactId = perContactId; - List committeList = new List(); - for(String committeeName : perConIdVsOldCommittesName.get(perContactId)){ - committeList.add(new cls_committiees(committeeName)); + if(oldAccount.Committee__pc != newAccount.Committee__pc){ + if(newAccount.Committee__pc == 'EDRD Advisory Committee' || newAccount.Committee__pc == 'EDRD Advisory/ Sub Committee'){ + if(!perConIdVsnewCommitteeName.containsKey(newAccount.perSonContactId)){ + perConIdVsnewCommitteeName.put(newAccount.perSonContactId, new Set{'EDRD Advisory Committee'}); + }else { + perConIdVsnewCommitteeName.get(newAccount.perSonContactId).add('EDRD Advisory Committee'); + } + } } - gMWObj.committiees = committeList; - perConIdVsOldCommittesNameSTRList.add(JSON.serialize(gMWObj)); - } - - List perConIdVsnewCommitteeNameSTRList = new List(); - - for(Id perContactId: perConIdVsnewCommitteeName.keySet()){ - groupMemberWrapper gMWObj = new groupMemberWrapper(); - gMWObj.personContactId = perContactId; - List committeList = new List(); - for(String committeeName : perConIdVsnewCommitteeName.get(perContactId)){ - committeList.add(new cls_committiees(committeeName)); + for(Id perContactId: perConIdVsOldCommittesName.keySet()){ + groupMemberWrapper gMWObj = new groupMemberWrapper(); + gMWObj.personContactId = perContactId; + List committeList = new List(); + for(String committeeName : perConIdVsOldCommittesName.get(perContactId)){ + committeList.add(new cls_committiees(committeeName)); + } + gMWObj.committiees = committeList; + perConIdVsOldCommittesNameSTRList.add(JSON.serialize(gMWObj)); + } + + for(Id perContactId: perConIdVsnewCommitteeName.keySet()){ + groupMemberWrapper gMWObj = new groupMemberWrapper(); + gMWObj.personContactId = perContactId; + List committeList = new List(); + for(String committeeName : perConIdVsnewCommitteeName.get(perContactId)){ + committeList.add(new cls_committiees(committeeName)); + } + gMWObj.committiees = committeList; + perConIdVsnewCommitteeNameSTRList.add(JSON.serialize(gMWObj)); + } + if(!perConIdVsOldCommittesNameSTRList.isEmpty() || !perConIdVsnewCommitteeNameSTRList.isEmpty()){ + EDRD_cls_HandleGroups.handleGroupMembership(perConIdVsOldCommittesNameSTRList, perConIdVsnewCommitteeNameSTRList); } - gMWObj.committiees = committeList; - perConIdVsnewCommitteeNameSTRList.add(JSON.serialize(gMWObj)); } - EDRD_cls_HandleGroups.handleGroupMembership(perConIdVsOldCommittesNameSTRList, perConIdVsnewCommitteeNameSTRList); } /** diff --git a/force-app/main/default/classes/ESA_cls_constants.cls b/force-app/main/default/classes/ESA_cls_constants.cls index 93e2262e6..9b397358e 100644 --- a/force-app/main/default/classes/ESA_cls_constants.cls +++ b/force-app/main/default/classes/ESA_cls_constants.cls @@ -19,6 +19,7 @@ public class ESA_cls_constants { public static final String EDRD_CASE_MOHFUNDING_DENIED = 'Denied'; public static final String EDRD_CASE_STATUS_CANCELLED = 'Cancelled'; public static final String EDRD_CASE_STATUS_FUNDING_APPROVED = 'Funding Approved'; + public static final String EDRD_COMMITTEE_REVIEWER = 'Committee_Reviewer'; public static final String EDRD_FORMULATION_BOTTLE = 'Bottle'; public static final String EDRD_FUNDING_DECISION_DENIED = 'Denied'; public static final String EDRD_NAME = 'EDRD'; diff --git a/force-app/main/default/classes/UserTriggerHandler.cls b/force-app/main/default/classes/UserTriggerHandler.cls index b828a4f2f..f58a43290 100644 --- a/force-app/main/default/classes/UserTriggerHandler.cls +++ b/force-app/main/default/classes/UserTriggerHandler.cls @@ -4,10 +4,13 @@ * @Description: The purpose of this class is to create methods which can be used by different trigger event * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 24Sept - EDRD-911 - Accenture - Added activateACROnEDRDPortalEnable method + 07Jan - EDRD-1150 - Accenture - Added handleEDRDPublicGroupMember method + 07Jan - EDRD-1150 - Accenture - Added handleGroupsForUsersAsync method ***********************************************************************************************/ public with sharing class UserTriggerHandler { public static Id eDRDPrescriberProfileId = [SELECT Id FROM Profile WHERE Name =: ESA_cls_constants.EDRD_PRESCRIBER_COMMUNITY_USER LIMIT 1].Id; public static Id recordTypeProvider = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(ESA_cls_constants.EDRD_PROVIDER).getRecordTypeId(); + public static Id recordTypeEDRDReviewer = Schema.SObjectType.Account.getRecordTypeInfosByDeveloperName().get(ESA_cls_constants.EDRD_COMMITTEE_REVIEWER).getRecordTypeId(); /** * @author: Deepak @@ -59,4 +62,79 @@ public with sharing class UserTriggerHandler { System.debug('An unexpected error occurred: ' + ex.getMessage()); } } + +/** +* @author: Deepak +* @date: 07 Jan 2025 +* @description: The purpose of this method is to activate EDRD related ACR on provider releated to user. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public static void handleEDRDPublicGroupMember(List newUserList) { + Set userIdSet = new Set(); + + for (User userObj : newUserList) { + if ((userObj.ProfileId == eDRDPrescriberProfileId && userObj.IsPortalEnabled)) { + userIdSet.add(userObj.Id); + } + } + + if (!userIdSet.isEmpty()) { + handleGroupsForUsersAsync(userIdSet); + } + } + +/** +* @author: Deepak +* @date: 07 Jan 2025 +* @description: The purpose of this method is to async and insert the public groupmember records. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @future + public static void handleGroupsForUsersAsync(Set userIds){ + Map committeeToGroupMap = new Map(); + Map groupNameVsGroupId = new Map(); + Map> userIdVsGroupsToBeAdded = new Map>(); + List groupMemberToInsert = new List(); + List relevantUsers = new List(); + + relevantUsers = [SELECT Id, ContactId, Contact.AccountId, Contact.Account.Committee__pc, Contact.Account.Committee_Name__pc + FROM User WHERE Id IN :userIds + AND (Contact.Account.Committee__pc != NULL OR Contact.Account.Committee_Name__pc != NULL) + AND (Account.RecordTypeId = :recordTypeProvider OR Account.RecordTypeId = :recordTypeEDRDReviewer)]; + + for (User userObj : relevantUsers) { + if (userObj.Contact.Account.Committee_Name__pc != NULL) { + userIdVsGroupsToBeAdded.put(userObj.Id, userObj.Contact.Account.Committee_Name__pc.split(';')); + } + if (userObj.Contact.Account.Committee__pc != NULL && userObj.Contact.Account.Committee_Name__pc == NULL) { + userIdVsGroupsToBeAdded.put(userObj.Id, new List{userObj.Contact.Account.Committee__pc}); + } + } + + if (!userIdVsGroupsToBeAdded.isEmpty()) { + Set publicGroupName = new Set(); + + for (EDRD_Public_Grp_vs_Committee__mdt metadataRecord : [SELECT Committee_Name__c, EDRD_Public_Group_Name__c + FROM EDRD_Public_Grp_vs_Committee__mdt]) { + committeeToGroupMap.put(metadataRecord.Committee_Name__c, metadataRecord.EDRD_Public_Group_Name__c); + publicGroupName.add(metadataRecord.EDRD_Public_Group_Name__c); + } + List groupList = [SELECT Id, Name, DeveloperName FROM Group WHERE DeveloperName IN :publicGroupName]; + + for (Group grpObj : groupList) { + groupNameVsGroupId.put(grpObj.DeveloperName, grpObj.Id); + } + + for (Id userId : userIdVsGroupsToBeAdded.keySet()) { + for (String committeeName : userIdVsGroupsToBeAdded.get(userId)) { + groupMemberToInsert.add(new GroupMember(UserOrGroupId = userId, + GroupId = groupNameVsGroupId.get(committeeToGroupMap.get(committeeName)))); + } + } + } + + if (!groupMemberToInsert.isEmpty()) { + Database.insert(groupMemberToInsert, true); + } + } } \ No newline at end of file diff --git a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml index 549ccaec5..c9e471c07 100644 --- a/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml +++ b/force-app/main/default/customMetadata/EDRD_Public_Grp_vs_Committee.EDRD_Advisory_Committee.md-meta.xml @@ -4,7 +4,7 @@ false Committee_Name__c - + EDRD Advisory Committee EDRD_Public_Group_Name__c diff --git a/force-app/main/default/triggers/UserTrigger.trigger b/force-app/main/default/triggers/UserTrigger.trigger index 89a16ce27..545af30b8 100644 --- a/force-app/main/default/triggers/UserTrigger.trigger +++ b/force-app/main/default/triggers/UserTrigger.trigger @@ -4,10 +4,13 @@ * @Description: The purpose of this Trigger is to trigger on particular events on user * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 24 Sep - EDRD-911 - Accenture - Added activateACROnEDRDportalEnable method + 07Jan - EDRD-1150 - Accenture - Added handleEDRDPublicGroupMember method + 07Jan - EDRD-1150 - Accenture - Added handleGroupsForUsersAsync method ***********************************************************************************************/ trigger UserTrigger on User (after insert) { if(trigger.isInsert && trigger.isAfter){ UserTriggerHandler.activateACROnEDRDPortalEnable(trigger.new); + UserTriggerHandler.handleEDRDPublicGroupMember(trigger.new); } } \ No newline at end of file From 7773460e60fdf72badf06dfe373a7f4f340edb34 Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Wed, 8 Jan 2025 05:47:52 -0500 Subject: [PATCH 06/12] Changes-1 --- force-app/main/default/classes/EDRD_cls_HandleGroups.cls | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls index 842c48faa..dcad2845f 100644 --- a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls @@ -5,7 +5,7 @@ * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees ***********************************************************************************************/ -public without Sharing class EDRD_cls_HandleGroups { +public with Sharing class EDRD_cls_HandleGroups { /** * @author: Deepak @@ -78,7 +78,6 @@ public without Sharing class EDRD_cls_HandleGroups { delete groupMemberToDelete; } } - for(Id perContactId :perConIdVsnewCommitteeName.KeySet()){ for(String committeeName: perConIdVsnewCommitteeName.get(perContactId)){ From dbcc804ed30f4332cfeb55e0e2cc37a92896010e Mon Sep 17 00:00:00 2001 From: deepakmulamalla Date: Wed, 8 Jan 2025 06:49:39 -0500 Subject: [PATCH 07/12] Chnages related without sharing --- force-app/main/default/classes/EDRD_cls_HandleGroups.cls | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls index dcad2845f..5ce0d1efa 100644 --- a/force-app/main/default/classes/EDRD_cls_HandleGroups.cls +++ b/force-app/main/default/classes/EDRD_cls_HandleGroups.cls @@ -5,7 +5,7 @@ * @Revision(s): [Date] - [Change Reference] - [Changed By] - [Description] 20 Dec - EDRD-1150 - Accenture - Adding/Removing - Provider/Reviewer to public groups based on Committees ***********************************************************************************************/ -public with Sharing class EDRD_cls_HandleGroups { +public without Sharing class EDRD_cls_HandleGroups { /** * @author: Deepak From d450e372e5a3216d2b49c22044ee68918bf923f6 Mon Sep 17 00:00:00 2001 From: RAJNISH SINGH Date: Wed, 8 Jan 2025 19:09:17 +0530 Subject: [PATCH 08/12] EDRD-1091CF --- .../EDRD_ProviderName__c.field-meta.xml | 12 +++++++ ...son_for_adherence_issues__c.field-meta.xml | 1 + .../Case/fields/Reason__c.field-meta.xml | 32 +++++++++++++++++++ 3 files changed, 45 insertions(+) create mode 100644 force-app/main/default/objects/Case/fields/EDRD_ProviderName__c.field-meta.xml create mode 100644 force-app/main/default/objects/Case/fields/Reason__c.field-meta.xml diff --git a/force-app/main/default/objects/Case/fields/EDRD_ProviderName__c.field-meta.xml b/force-app/main/default/objects/Case/fields/EDRD_ProviderName__c.field-meta.xml new file mode 100644 index 000000000..edfee485d --- /dev/null +++ b/force-app/main/default/objects/Case/fields/EDRD_ProviderName__c.field-meta.xml @@ -0,0 +1,12 @@ + + + EDRD_ProviderName__c + false + Provider__r.Account.FirstName +' '+ Provider__r.Account.LastName + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Case/fields/EDRD_Reason_for_adherence_issues__c.field-meta.xml b/force-app/main/default/objects/Case/fields/EDRD_Reason_for_adherence_issues__c.field-meta.xml index 131d997b1..0692c11d6 100644 --- a/force-app/main/default/objects/Case/fields/EDRD_Reason_for_adherence_issues__c.field-meta.xml +++ b/force-app/main/default/objects/Case/fields/EDRD_Reason_for_adherence_issues__c.field-meta.xml @@ -9,6 +9,7 @@ false false false + false Text false diff --git a/force-app/main/default/objects/Case/fields/Reason__c.field-meta.xml b/force-app/main/default/objects/Case/fields/Reason__c.field-meta.xml new file mode 100644 index 000000000..add279e7b --- /dev/null +++ b/force-app/main/default/objects/Case/fields/Reason__c.field-meta.xml @@ -0,0 +1,32 @@ + + + Reason__c + false + + false + false + false + false + Picklist + + true + + false + + No PHN Provided. + false + + + + Patient record not fount. + false + + + + Patient record does not match. + false + + + + + From e8b91dddf0427226c591fc772373e9b1cf3efa1b Mon Sep 17 00:00:00 2001 From: RAJNISH SINGH Date: Wed, 8 Jan 2025 19:43:18 +0530 Subject: [PATCH 09/12] EDRD-99V1 --- .../Committee_Review_Case__c.object-meta.xml | 167 ++++++++++++++++++ .../fields/Account_Provider__c.field-meta.xml | 13 ++ .../fields/CaseType__c.field-meta.xml | 13 ++ .../fields/Case_EDRD_Ref_No__c.field-meta.xml | 13 ++ ...Case_Funding_Expiry_Date__c.field-meta.xml | 12 ++ ...se_RPh_Simplified_Review__c.field-meta.xml | 13 ++ .../fields/CommitteeType__c.field-meta.xml | 13 ++ .../fields/Meeting_Name__c.field-meta.xml | 13 ++ .../fields/Order__c.field-meta.xml | 13 ++ .../fields/Related_Case__c.field-meta.xml | 14 ++ ...Earliest_Start_Permitted__c.field-meta.xml | 12 ++ .../ServiceAppoinmentName__c.field-meta.xml | 13 ++ ...rvice_Appointment_Number__c.field-meta.xml | 13 ++ .../Service_Appointment__c.field-meta.xml | 28 +++ .../listViews/All.listView-meta.xml | 9 + 15 files changed, 359 insertions(+) create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/Committee_Review_Case__c.object-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Account_Provider__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/CaseType__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Case_EDRD_Ref_No__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Case_Funding_Expiry_Date__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Case_RPh_Simplified_Review__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/CommitteeType__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Meeting_Name__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Order__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Related_Case__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/SA_Earliest_Start_Permitted__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/ServiceAppoinmentName__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment_Number__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment__c.field-meta.xml create mode 100644 force-app/main/default/objects/Committee_Review_Case__c/listViews/All.listView-meta.xml diff --git a/force-app/main/default/objects/Committee_Review_Case__c/Committee_Review_Case__c.object-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/Committee_Review_Case__c.object-meta.xml new file mode 100644 index 000000000..6fa961e9e --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/Committee_Review_Case__c.object-meta.xml @@ -0,0 +1,167 @@ + + + + Accept + Default + + + Accept + Large + Default + + + Accept + Small + Default + + + CancelEdit + Default + + + CancelEdit + Large + Default + + + CancelEdit + Small + Default + + + Clone + Default + + + Clone + Large + Default + + + Clone + Small + Default + + + Delete + Default + + + Delete + Large + Default + + + Delete + Small + Default + + + Edit + Default + + + Edit + Large + Default + + + Edit + Small + Default + + + List + Default + + + List + Large + Default + + + List + Small + Default + + + New + Default + + + New + Large + Default + + + New + Small + Default + + + SaveEdit + Default + + + SaveEdit + Large + Default + + + SaveEdit + Small + Default + + + Tab + Default + + + Tab + Large + Default + + + Tab + Small + Default + + + View + Default + + + View + Large + Default + + + View + Small + Default + + false + SYSTEM + Deployed + true + true + false + true + false + true + true + true + true + Private + + + CRC-{0000} + + false + AutoNumber + + Committee Review Cases + + ReadWrite + Public + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Account_Provider__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Account_Provider__c.field-meta.xml new file mode 100644 index 000000000..265c957b6 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Account_Provider__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Account_Provider__c + false + Related_Case__r.EDRD_ProviderName__c + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/CaseType__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/CaseType__c.field-meta.xml new file mode 100644 index 000000000..30908c5bf --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/CaseType__c.field-meta.xml @@ -0,0 +1,13 @@ + + + CaseType__c + false + TEXT(Related_Case__r.Type) + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_EDRD_Ref_No__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_EDRD_Ref_No__c.field-meta.xml new file mode 100644 index 000000000..8762c2e1b --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_EDRD_Ref_No__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Case_EDRD_Ref_No__c + false + Related_Case__r.EDRD_Ref_No__c + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_Funding_Expiry_Date__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_Funding_Expiry_Date__c.field-meta.xml new file mode 100644 index 000000000..84b87013e --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_Funding_Expiry_Date__c.field-meta.xml @@ -0,0 +1,12 @@ + + + Case_Funding_Expiry_Date__c + false + Related_Case__r.EDRD_Funding_Expiry_Date__c + BlankAsZero + + false + false + false + Date + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_RPh_Simplified_Review__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_RPh_Simplified_Review__c.field-meta.xml new file mode 100644 index 000000000..fe94c9bc0 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Case_RPh_Simplified_Review__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Case_RPh_Simplified_Review__c + false + TEXT(Related_Case__r.EDRD_RPH_Simplified_Review__c) + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/CommitteeType__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/CommitteeType__c.field-meta.xml new file mode 100644 index 000000000..6b8ffeecd --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/CommitteeType__c.field-meta.xml @@ -0,0 +1,13 @@ + + + CommitteeType__c + false + TEXT(Service_Appointment__r.Account.EDRD_Committee_Type__c ) + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Meeting_Name__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Meeting_Name__c.field-meta.xml new file mode 100644 index 000000000..14826338c --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Meeting_Name__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Meeting_Name__c + false + Service_Appointment__r.EDRD_Name__c + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Order__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Order__c.field-meta.xml new file mode 100644 index 000000000..11f19b4c4 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Order__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Order__c + false + + 2 + false + 0 + false + false + Number + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Related_Case__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Related_Case__c.field-meta.xml new file mode 100644 index 000000000..e30cbd41c --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Related_Case__c.field-meta.xml @@ -0,0 +1,14 @@ + + + Related_Case__c + SetNull + false + + Case + Committee Review Cases + Committee_Review_Cases + false + false + false + Lookup + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/SA_Earliest_Start_Permitted__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/SA_Earliest_Start_Permitted__c.field-meta.xml new file mode 100644 index 000000000..fddb64fe6 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/SA_Earliest_Start_Permitted__c.field-meta.xml @@ -0,0 +1,12 @@ + + + SA_Earliest_Start_Permitted__c + false + Service_Appointment__r.EarliestStartTime + BlankAsZero + + false + false + false + Date + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/ServiceAppoinmentName__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/ServiceAppoinmentName__c.field-meta.xml new file mode 100644 index 000000000..c460dfd0a --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/ServiceAppoinmentName__c.field-meta.xml @@ -0,0 +1,13 @@ + + + ServiceAppoinmentName__c + false + Service_Appointment__r.EDRD_Name__c + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment_Number__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment_Number__c.field-meta.xml new file mode 100644 index 000000000..4795d64d1 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment_Number__c.field-meta.xml @@ -0,0 +1,13 @@ + + + Service_Appointment_Number__c + false + Service_Appointment__r.AppointmentNumber + BlankAsZero + + false + false + false + Text + false + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment__c.field-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment__c.field-meta.xml new file mode 100644 index 000000000..ea75fc971 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/fields/Service_Appointment__c.field-meta.xml @@ -0,0 +1,28 @@ + + + Service_Appointment__c + SetNull + false + + + true + + ServiceAppointment.Status + equals + Planned + + + $Profile.Name + equals + MoH Standard User, Service Account Profile, System Administrator + + false + + ServiceAppointment + Committee Review Cases + Committee_Review_Cases + false + false + false + Lookup + diff --git a/force-app/main/default/objects/Committee_Review_Case__c/listViews/All.listView-meta.xml b/force-app/main/default/objects/Committee_Review_Case__c/listViews/All.listView-meta.xml new file mode 100644 index 000000000..53ddd62d8 --- /dev/null +++ b/force-app/main/default/objects/Committee_Review_Case__c/listViews/All.listView-meta.xml @@ -0,0 +1,9 @@ + + + All + NAME + Related_Case__c + Service_Appointment__c + Everything + + From df12a6fa8ca5285cc699b9663c0e3912d70cd501 Mon Sep 17 00:00:00 2001 From: RAJNISH SINGH Date: Wed, 8 Jan 2025 20:10:09 +0530 Subject: [PATCH 10/12] EDRD-1091PermissionSet --- .../EDRD_PS_MOH_Staff.permissionset-meta.xml | 74 +++++++++++++ ...Operational_Support.permissionset-meta.xml | 102 ++++++++++++++++-- ...D_PS_PHSA_PSP_Staff.permissionset-meta.xml | 88 ++++++++++++++- .../EDRD_PS_Physicians.permissionset-meta.xml | 65 ++++++++++- .../EDRD_Super_User.permissionset-meta.xml | 5 + 5 files changed, 318 insertions(+), 16 deletions(-) diff --git a/force-app/main/default/permissionsets/EDRD_PS_MOH_Staff.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_PS_MOH_Staff.permissionset-meta.xml index ba12c1c4f..b89b170f6 100644 --- a/force-app/main/default/permissionsets/EDRD_PS_MOH_Staff.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_PS_MOH_Staff.permissionset-meta.xml @@ -474,6 +474,71 @@ Case.Type true + + false + Committee_Review_Case__c.Account_Provider__c + true + + + false + Committee_Review_Case__c.CaseType__c + true + + + false + Committee_Review_Case__c.Case_EDRD_Ref_No__c + true + + + false + Committee_Review_Case__c.Case_Funding_Expiry_Date__c + true + + + false + Committee_Review_Case__c.Case_RPh_Simplified_Review__c + true + + + false + Committee_Review_Case__c.CommitteeType__c + true + + + false + Committee_Review_Case__c.Meeting_Name__c + true + + + false + Committee_Review_Case__c.Order__c + true + + + false + Committee_Review_Case__c.Related_Case__c + true + + + false + Committee_Review_Case__c.SA_Earliest_Start_Permitted__c + true + + + false + Committee_Review_Case__c.ServiceAppoinmentName__c + true + + + false + Committee_Review_Case__c.Service_Appointment_Number__c + true + + + false + Committee_Review_Case__c.Service_Appointment__c + true + true Contact.AccountId @@ -1136,6 +1201,15 @@ CodeSetBundle false + + false + false + false + true + false + Committee_Review_Case__c + true + true false diff --git a/force-app/main/default/permissionsets/EDRD_PS_Operational_Support.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_PS_Operational_Support.permissionset-meta.xml index 9b0a0ebe0..fb6622a4b 100644 --- a/force-app/main/default/permissionsets/EDRD_PS_Operational_Support.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_PS_Operational_Support.permissionset-meta.xml @@ -134,27 +134,32 @@ false - AccountContactRelation.ContactAccountId__c + AccountContactRelation.EndDate true - true - AccountContactRelation.EndDate + false + AccountContactRelation.HealthCloudGA__PrimaryGroup__c true - true - AccountContactRelation.IsActive + false + AccountContactRelation.HealthCloudGA__Primary__c true - true - AccountContactRelation.Is_EDRD_Data_Migration__c + false + AccountContactRelation.HealthCloudGA__Rollups__c true false - AccountContactRelation.Is_Person_Account__c + AccountContactRelation.IsActive + true + + + false + AccountContactRelation.Is_EDRD_Data_Migration__c true @@ -163,7 +168,7 @@ true - true + false AccountContactRelation.StartDate true @@ -427,6 +432,11 @@ Case.EDRD_Please_specify_other__c true + + false + Case.EDRD_ProviderName__c + true + true Case.EDRD_RPH_Patient_Not_Meet_Criteria__c @@ -577,6 +587,71 @@ Case.Type true + + false + Committee_Review_Case__c.Account_Provider__c + true + + + false + Committee_Review_Case__c.CaseType__c + true + + + false + Committee_Review_Case__c.Case_EDRD_Ref_No__c + true + + + false + Committee_Review_Case__c.Case_Funding_Expiry_Date__c + true + + + false + Committee_Review_Case__c.Case_RPh_Simplified_Review__c + true + + + false + Committee_Review_Case__c.CommitteeType__c + true + + + false + Committee_Review_Case__c.Meeting_Name__c + true + + + false + Committee_Review_Case__c.Order__c + true + + + true + Committee_Review_Case__c.Related_Case__c + true + + + false + Committee_Review_Case__c.SA_Earliest_Start_Permitted__c + true + + + false + Committee_Review_Case__c.ServiceAppoinmentName__c + true + + + false + Committee_Review_Case__c.Service_Appointment_Number__c + true + + + true + Committee_Review_Case__c.Service_Appointment__c + true + true Contact.AccountId @@ -1219,6 +1294,15 @@ CodeSetBundle true + + true + false + true + true + false + Committee_Review_Case__c + true + true true diff --git a/force-app/main/default/permissionsets/EDRD_PS_PHSA_PSP_Staff.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_PS_PHSA_PSP_Staff.permissionset-meta.xml index 1c2cfb866..d4310df22 100644 --- a/force-app/main/default/permissionsets/EDRD_PS_PHSA_PSP_Staff.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_PS_PHSA_PSP_Staff.permissionset-meta.xml @@ -224,6 +224,11 @@ Case.EDRD_Eligibility_Form_Signed_Date__c true + + false + Case.EDRD_Funding_Expiry_Date__c + true + true Case.EDRD_Insurance_Provider__c @@ -279,11 +284,6 @@ Case.EDRD_MOHFunding_Decision__c true - - true - Case.EDRD_MOHFunding_Expiry_Date__c - true - false Case.EDRD_MOHFunding_Extension_Date__c @@ -474,6 +474,71 @@ Case.Type true + + false + Committee_Review_Case__c.Account_Provider__c + true + + + false + Committee_Review_Case__c.CaseType__c + true + + + false + Committee_Review_Case__c.Case_EDRD_Ref_No__c + true + + + false + Committee_Review_Case__c.Case_Funding_Expiry_Date__c + true + + + false + Committee_Review_Case__c.Case_RPh_Simplified_Review__c + true + + + false + Committee_Review_Case__c.CommitteeType__c + true + + + false + Committee_Review_Case__c.Meeting_Name__c + true + + + true + Committee_Review_Case__c.Order__c + true + + + true + Committee_Review_Case__c.Related_Case__c + true + + + false + Committee_Review_Case__c.SA_Earliest_Start_Permitted__c + true + + + false + Committee_Review_Case__c.ServiceAppoinmentName__c + true + + + false + Committee_Review_Case__c.Service_Appointment_Number__c + true + + + true + Committee_Review_Case__c.Service_Appointment__c + true + false Contact.AccountId @@ -1136,6 +1201,15 @@ CodeSetBundle false + + true + false + true + true + false + Committee_Review_Case__c + false + true false @@ -1287,6 +1361,10 @@ ServiceAppointment.EDRD_Committee_Meeting true + + Committee_Review_Case__c + Visible + Medical_Diagnosis__c Visible diff --git a/force-app/main/default/permissionsets/EDRD_PS_Physicians.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_PS_Physicians.permissionset-meta.xml index d31e48fe1..815621601 100644 --- a/force-app/main/default/permissionsets/EDRD_PS_Physicians.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_PS_Physicians.permissionset-meta.xml @@ -26,6 +26,11 @@ Account.Fax true + + true + Account.ParentId + true + false Account.Person_Full_Name__c @@ -41,6 +46,21 @@ Account.Type true + + false + AccountContactRelation.ContactAccountId__c + true + + + true + AccountContactRelation.IsActive + true + + + false + AccountContactRelation.Is_Person_Account__c + true + false AssessmentQuestionResponse.Question_Text__c @@ -211,6 +231,21 @@ Case.Type true + + false + Committee_Review_Case__c.Order__c + true + + + false + Committee_Review_Case__c.Related_Case__c + true + + + false + Committee_Review_Case__c.Service_Appointment__c + true + false Contact.AccountId @@ -518,9 +553,18 @@ false - false + true false - false + true + true + false + Committee_Review_Case__c + false + + + true + false + true true false Contact @@ -535,6 +579,15 @@ Medical_Diagnosis__c false + + false + false + false + true + false + ServiceAppointment + false + false false @@ -568,6 +621,14 @@ PersonAccount.Provider true + + Committee_Review_Case__c + Visible + + + standard-ServiceAppointment + Visible + true AssessmentPlatformUser diff --git a/force-app/main/default/permissionsets/EDRD_Super_User.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_Super_User.permissionset-meta.xml index fa85d0ba2..3e5374d96 100644 --- a/force-app/main/default/permissionsets/EDRD_Super_User.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_Super_User.permissionset-meta.xml @@ -421,6 +421,11 @@ Case.EDRD_Please_specify_other__c true + + false + Case.EDRD_ProviderName__c + true + true Case.EDRD_RPH_Patient_Not_Meet_Criteria__c From 9a2ea151e9567fb87808564199c7bd35771db5eb Mon Sep 17 00:00:00 2001 From: RAJNISH SINGH Date: Thu, 9 Jan 2025 12:45:32 +0530 Subject: [PATCH 11/12] EDRD-1091PermissionSet --- .../main/default/tabs/Committee_Review_Case__c.tab-meta.xml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 force-app/main/default/tabs/Committee_Review_Case__c.tab-meta.xml diff --git a/force-app/main/default/tabs/Committee_Review_Case__c.tab-meta.xml b/force-app/main/default/tabs/Committee_Review_Case__c.tab-meta.xml new file mode 100644 index 000000000..fb8762236 --- /dev/null +++ b/force-app/main/default/tabs/Committee_Review_Case__c.tab-meta.xml @@ -0,0 +1,5 @@ + + + true + Custom84: Presenter + From bd1be70eb07517d33315588e65fa506c2a845fd1 Mon Sep 17 00:00:00 2001 From: RAJNISH SINGH Date: Thu, 9 Jan 2025 18:13:19 +0530 Subject: [PATCH 12/12] EDRD-90V1 --- .../sharingSets/EDRD_grantCaseAccess.sharingSet-meta.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/dev-app-post/main/default/sharingSets/EDRD_grantCaseAccess.sharingSet-meta.xml b/dev-app-post/main/default/sharingSets/EDRD_grantCaseAccess.sharingSet-meta.xml index 9c337e9a2..fab317f40 100644 --- a/dev-app-post/main/default/sharingSets/EDRD_grantCaseAccess.sharingSet-meta.xml +++ b/dev-app-post/main/default/sharingSets/EDRD_grantCaseAccess.sharingSet-meta.xml @@ -6,6 +6,12 @@ Provider__c.Account Contact.Account + + Read + ServiceAppointment + Account + Contact.RelatedAccount + EDRD_grantCaseAccess edrd prescriber community user