diff --git a/dev-app-post/main/default/classes/ESA_cls_caseTriggerHandlerTest.cls b/dev-app-post/main/default/classes/ESA_cls_caseTriggerHandlerTest.cls index 962965a27..ac87d8d60 100644 --- a/dev-app-post/main/default/classes/ESA_cls_caseTriggerHandlerTest.cls +++ b/dev-app-post/main/default/classes/ESA_cls_caseTriggerHandlerTest.cls @@ -10,7 +10,8 @@ 15 Jan - EDRD-525 - Accenture - Update AC Recommendation Review 19 Jan- EDRD-338 - Accenture - Update Funding Expiry Date 20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number - 08 Aug- EDRD-679 - Accenture - Generate FY forecasting records + 08 Aug- EDRD-679 - Accenture - Generate FY forecasting records + 17 Oct- EDRD-1010 - Accenture - Update Provider's - EDRD Checkbox On EDRD Case Insert ***********************************************************************************************/ @isTest @@ -416,4 +417,29 @@ public class ESA_cls_caseTriggerHandlerTest { Assert.areEqual(7, forecastRecords.size(), 'FY-MedicationDispense records should be created'); Assert.areNotEqual(0, forecastRecords.size(), 'Forecast records should not be created'); } + +/** +* @author: Deepak +* @date: 17 Oct 2024 +* @description: The purpose of this method is to cover Testcoverage of delete UpdateProviderOnEDRDCase +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @isTest + public static void UpdateProviderOnEDRDCaseTest(){ + Account providerAccount = TestFactory.newProvider('Provider Test'); + providerAccount.Is_EDRD_Provider__pc = FALSE; + insert providerAccount; + Id recordTypeCaseEDRD = Schema.SObjectType.Case.getRecordTypeInfosByDeveloperName().get('EDRD').getRecordTypeId(); + List conList = [SELECT Id FROM Contact WHERE accountID =: providerAccount.Id LIMIT 1]; + List caseRec = TestFactory.createEDRDCase(1, recordTypeCaseEDRD, providerAccount.Id); + caseRec.get(0).provider__c = conList.get(0).Id; + + Test.startTest(); + insert caseRec; + Test.stopTest(); + + List providerRecords = [SELECT Id, Is_EDRD_Provider__pc FROM Account WHERE Id =: providerAccount.Id]; + Assert.areEqual(TRUE, providerRecords.get(0).Is_EDRD_Provider__pc, 'Is EDRD Provider Field should be True'); + Assert.areNotEqual(FALSE, providerRecords.get(0).Is_EDRD_Provider__pc, 'Is EDRD Provider Field cannot be False'); + } } \ No newline at end of file diff --git a/force-app/main/default/classes/ESA_cls_caseTriggerHandler.cls b/force-app/main/default/classes/ESA_cls_caseTriggerHandler.cls index 7acdaeba8..1bbf5bc82 100644 --- a/force-app/main/default/classes/ESA_cls_caseTriggerHandler.cls +++ b/force-app/main/default/classes/ESA_cls_caseTriggerHandler.cls @@ -12,6 +12,8 @@ 19 Jan- EDRD-382 - Accenture - Validate Eligibility Form Sign date and Eligibility form Attachment 20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number 07 Jun- EDRD-679 - Accenture - Generate FY forecasting records + 17 Oct- EDRD-1010 - Accenture - Collect set of caseId's and pass it to future method + 17 Oct- EDRD-1010 - Accenture - Future method(Private) is to update EDRD Provider field on Person Account. ***********************************************************************************************/ public with sharing class ESA_cls_caseTriggerHandler { @@ -342,4 +344,46 @@ public with sharing class ESA_cls_caseTriggerHandler { Database.delete(caseRelatedFYF, true); } } + +/** +* @author: Deepak +* @date: 17 Oct 2024 +* @description: The purpose of this method collect set of caseId's and pass it to future method. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + public static void UpdateProviderOnEDRDCase(List newCaseList) { + Set caseIdSet = new Set(); + + for (Case caseObj : newCaseList) { + if (caseObj.RecordTypeId == recordTypeCaseEDRD) { + caseIdSet.add(caseObj.Id); + } + } + + if (!caseIdSet.isEmpty()) { + UpdateProviderAccountsAsync(caseIdSet); + } + } + +/** +* @author: Deepak +* @date: 17 Oct 2024 +* @description: The purpose of this future method is to update EDRD Provider field on Person Account. +* @Modification Log: [Date] - [Change Reference] - [Changed By] - [Description] +*/ + @future + private static void UpdateProviderAccountsAsync(Set caseIdSet) { + Map accIdVsRecToUpdate = new Map(); + + List caseList = [SELECT Id, Provider__r.AccountId FROM Case WHERE Id IN :caseIdSet AND Provider__c != NULL + AND Provider__r.Account.Is_EDRD_Provider__pc = FALSE]; + + for (Case caseObj : caseList) { + accIdVsRecToUpdate.put(caseObj.Provider__r.AccountId, new Account(Id = caseObj.Provider__r.AccountId, Is_EDRD_Provider__pc = TRUE)); + } + + if (!accIdVsRecToUpdate.isEmpty()) { + Database.Update(accIdVsRecToUpdate.values(), true); + } + } } \ No newline at end of file diff --git a/force-app/main/default/objects/Account/listViews/All_EDRD_Committees.listView-meta.xml b/force-app/main/default/objects/Account/listViews/All_EDRD_Committees.listView-meta.xml index f4b6de2ba..c14bb88dc 100644 --- a/force-app/main/default/objects/Account/listViews/All_EDRD_Committees.listView-meta.xml +++ b/force-app/main/default/objects/Account/listViews/All_EDRD_Committees.listView-meta.xml @@ -11,7 +11,7 @@ equals PersonAccount.Committee_Reviewer - + Developer EDRD_Admin diff --git a/force-app/main/default/objects/Account/listViews/All_EDRD_Patients.listView-meta.xml b/force-app/main/default/objects/Account/listViews/All_EDRD_Patients.listView-meta.xml index 442124484..db5b48028 100644 --- a/force-app/main/default/objects/Account/listViews/All_EDRD_Patients.listView-meta.xml +++ b/force-app/main/default/objects/Account/listViews/All_EDRD_Patients.listView-meta.xml @@ -2,6 +2,7 @@ All_EDRD_Patients ACCOUNT.NAME + EDRD_Ref_No__pc Patient_Identifier__pc ACCOUNT.PHONE1 ACCOUNT.PHONE2 @@ -13,7 +14,7 @@ equals PersonAccount.Patient - + Developer EDRD_Admin diff --git a/force-app/main/default/objects/Account/listViews/All_EDRD_Providers.listView-meta.xml b/force-app/main/default/objects/Account/listViews/All_EDRD_Providers.listView-meta.xml index 5e092594d..124c019e6 100644 --- a/force-app/main/default/objects/Account/listViews/All_EDRD_Providers.listView-meta.xml +++ b/force-app/main/default/objects/Account/listViews/All_EDRD_Providers.listView-meta.xml @@ -14,7 +14,7 @@ equals PersonAccount.Provider - + Developer EDRD_Admin diff --git a/force-app/main/default/objects/Account/listViews/All_Manufactuers.listView-meta.xml b/force-app/main/default/objects/Account/listViews/All_Manufactuers.listView-meta.xml index b6f772075..173c31284 100644 --- a/force-app/main/default/objects/Account/listViews/All_Manufactuers.listView-meta.xml +++ b/force-app/main/default/objects/Account/listViews/All_Manufactuers.listView-meta.xml @@ -8,7 +8,7 @@ equals Account.Manufacturer - + Developer EDRD_Admin diff --git a/force-app/main/default/objects/Account/listViews/EDRD_Enrolled_Patients.listView-meta.xml b/force-app/main/default/objects/Account/listViews/EDRD_Enrolled_Patients.listView-meta.xml new file mode 100644 index 000000000..9d7c3fccf --- /dev/null +++ b/force-app/main/default/objects/Account/listViews/EDRD_Enrolled_Patients.listView-meta.xml @@ -0,0 +1,26 @@ + + + EDRD_Enrolled_Patients + ACCOUNT.NAME + EDRD_Ref_No__pc + Patient_Identifier__pc + ACCOUNT.PHONE1 + ACCOUNT.PHONE2 + PC_ADDRESS2_CITY + PC_ADDRESS2_ZIP + Everything + + ACCOUNT.RECORDTYPE + equals + PersonAccount.Patient + + + EDRD_Ref_No__pc + notEqual + + + + Developer + EDRD_Admin + + diff --git a/force-app/main/default/objects/Account/listViews/EDRD_Related_Providers.listView-meta.xml b/force-app/main/default/objects/Account/listViews/EDRD_Related_Providers.listView-meta.xml new file mode 100644 index 000000000..4df515a9c --- /dev/null +++ b/force-app/main/default/objects/Account/listViews/EDRD_Related_Providers.listView-meta.xml @@ -0,0 +1,27 @@ + + + EDRD_Related_Providers + ACCOUNT.NAME + Provider_Type__pc + Provider_Identifier__pc + ACCOUNT.PHONE1 + ACCOUNT.PHONE2 + PC_ADDRESS2_CITY + PC_ADDRESS2_ZIP + Everything + + ACCOUNT.RECORDTYPE + equals + PersonAccount.Provider + + + Is_EDRD_Provider__pc + equals + 1 + + + + Developer + EDRD_Admin + + diff --git a/force-app/main/default/objects/Case/listViews/AC_Review.listView-meta.xml b/force-app/main/default/objects/Case/listViews/AC_Review.listView-meta.xml index 8002d28bc..0fe1f7b8f 100644 --- a/force-app/main/default/objects/Case/listViews/AC_Review.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/AC_Review.listView-meta.xml @@ -24,7 +24,7 @@ equals 0 - + EDRD_Admin diff --git a/force-app/main/default/objects/Case/listViews/All_EDRD_Cases.listView-meta.xml b/force-app/main/default/objects/Case/listViews/All_EDRD_Cases.listView-meta.xml index 093fdebbe..911c34ceb 100644 --- a/force-app/main/default/objects/Case/listViews/All_EDRD_Cases.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/All_EDRD_Cases.listView-meta.xml @@ -16,7 +16,7 @@ equals Case.EDRD - + EDRD_Admin diff --git a/force-app/main/default/objects/Case/listViews/EDRD_Ministry_Queue_Case.listView-meta.xml b/force-app/main/default/objects/Case/listViews/EDRD_Ministry_Queue_Case.listView-meta.xml index e0ea9db5c..8d87c703c 100644 --- a/force-app/main/default/objects/Case/listViews/EDRD_Ministry_Queue_Case.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/EDRD_Ministry_Queue_Case.listView-meta.xml @@ -14,7 +14,7 @@ equals Case.EDRD - + EDRD_Ministry_Queue Developer diff --git a/force-app/main/default/objects/Case/listViews/EDRD_PSP_Closed_Queue.listView-meta.xml b/force-app/main/default/objects/Case/listViews/EDRD_PSP_Closed_Queue.listView-meta.xml index 0b0ef92a4..d52b2f5f7 100644 --- a/force-app/main/default/objects/Case/listViews/EDRD_PSP_Closed_Queue.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/EDRD_PSP_Closed_Queue.listView-meta.xml @@ -19,7 +19,7 @@ equals Funding Approved,Cancelled,Funding Denied - + EDRD_PSP_Queue Developer diff --git a/force-app/main/default/objects/Case/listViews/EDRD_PSP_Queue_Case.listView-meta.xml b/force-app/main/default/objects/Case/listViews/EDRD_PSP_Queue_Case.listView-meta.xml index 585673c64..fd96e9282 100644 --- a/force-app/main/default/objects/Case/listViews/EDRD_PSP_Queue_Case.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/EDRD_PSP_Queue_Case.listView-meta.xml @@ -19,7 +19,7 @@ equals SC Review,AC Review,MOH Review,Received - Awaiting Verification - + EDRD_PSP_Queue Developer diff --git a/force-app/main/default/objects/Case/listViews/MOH_Review.listView-meta.xml b/force-app/main/default/objects/Case/listViews/MOH_Review.listView-meta.xml index 5000553fa..6b64d6401 100644 --- a/force-app/main/default/objects/Case/listViews/MOH_Review.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/MOH_Review.listView-meta.xml @@ -19,7 +19,7 @@ equals Case.EDRD - + EDRD_Admin diff --git a/force-app/main/default/objects/Case/listViews/My_EDRD_Close_Cases.listView-meta.xml b/force-app/main/default/objects/Case/listViews/My_EDRD_Close_Cases.listView-meta.xml index 3dc97f605..ea3314167 100644 --- a/force-app/main/default/objects/Case/listViews/My_EDRD_Close_Cases.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/My_EDRD_Close_Cases.listView-meta.xml @@ -22,7 +22,7 @@ equals 1 - + EDRD_Admin diff --git a/force-app/main/default/objects/Case/listViews/My_EDRD_Closed_Cases_Portal.listView-meta.xml b/force-app/main/default/objects/Case/listViews/My_EDRD_Closed_Cases_Portal.listView-meta.xml index 5b6dcd9c7..a92e0ac3e 100644 --- a/force-app/main/default/objects/Case/listViews/My_EDRD_Closed_Cases_Portal.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/My_EDRD_Closed_Cases_Portal.listView-meta.xml @@ -27,7 +27,7 @@ equals 1 - + EDRD_Physicians diff --git a/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases.listView-meta.xml b/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases.listView-meta.xml index c2a57ac6d..06a740cb6 100644 --- a/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases.listView-meta.xml @@ -20,7 +20,7 @@ equals Case.EDRD - + EDRD_Admin diff --git a/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases_Portal.listView-meta.xml b/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases_Portal.listView-meta.xml index 5419266e0..783097f3f 100644 --- a/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases_Portal.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/My_EDRD_Open_Cases_Portal.listView-meta.xml @@ -26,7 +26,7 @@ equals 1 - + EDRD_Physicians diff --git a/force-app/main/default/objects/Case/listViews/SC_Review.listView-meta.xml b/force-app/main/default/objects/Case/listViews/SC_Review.listView-meta.xml index a83e4d913..cd1743b74 100644 --- a/force-app/main/default/objects/Case/listViews/SC_Review.listView-meta.xml +++ b/force-app/main/default/objects/Case/listViews/SC_Review.listView-meta.xml @@ -24,7 +24,7 @@ equals 0 - + EDRD_Admin diff --git a/force-app/main/default/objects/Contact/fields/Is_EDRD_Provider__c.field-meta.xml b/force-app/main/default/objects/Contact/fields/Is_EDRD_Provider__c.field-meta.xml new file mode 100644 index 000000000..d005dafc8 --- /dev/null +++ b/force-app/main/default/objects/Contact/fields/Is_EDRD_Provider__c.field-meta.xml @@ -0,0 +1,11 @@ + + + Is_EDRD_Provider__c + false + This field will be true when Provider has Cases which is of recordtype = EDRD + false + + false + false + Checkbox + 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 374d06226..8eedf7df7 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 @@ -494,6 +494,11 @@ Contact.Fax true + + true + Contact.Is_EDRD_Provider__c + true + false Contact.Legacy_EDRD_Ref_No__c 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 5382c81db..6a0c11c2f 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 @@ -592,6 +592,11 @@ Contact.Fax true + + true + Contact.Is_EDRD_Provider__c + true + true Contact.Legacy_EDRD_Ref_No__c 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 90f754f39..2f8261332 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 @@ -494,6 +494,11 @@ Contact.Fax true + + true + Contact.Is_EDRD_Provider__c + true + false Contact.Legacy_EDRD_Ref_No__c diff --git a/force-app/main/default/permissionsets/EDRD_PS_Standard_User.permissionset-meta.xml b/force-app/main/default/permissionsets/EDRD_PS_Standard_User.permissionset-meta.xml index b1ca13e9d..f3ea20e2f 100644 --- a/force-app/main/default/permissionsets/EDRD_PS_Standard_User.permissionset-meta.xml +++ b/force-app/main/default/permissionsets/EDRD_PS_Standard_User.permissionset-meta.xml @@ -472,6 +472,11 @@ Contact.Fax true + + false + Contact.Is_EDRD_Provider__c + true + false Contact.Legacy_EDRD_Ref_No__c 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 e782ff0fe..b8e9d63b6 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 @@ -591,6 +591,11 @@ Contact.Fax true + + true + Contact.Is_EDRD_Provider__c + true + true Contact.Legacy_EDRD_Ref_No__c diff --git a/force-app/main/default/triggers/CaseTrigger.trigger b/force-app/main/default/triggers/CaseTrigger.trigger index 2c6895d76..975b0b6ac 100644 --- a/force-app/main/default/triggers/CaseTrigger.trigger +++ b/force-app/main/default/triggers/CaseTrigger.trigger @@ -12,6 +12,7 @@ 19 Jan - EDRD-338 - Accenture - Update Funding Expiry and Extension Date 19 Jan- EDRD-382 - Accenture - Validate Eligibility Form Sign date and Eligibility form Attachment 20 Jun- EDRD-764 - Accenture - Populate EDRD Reference number + 17 Oct- EDRD-1010 - Accenture - Update Provider's - EDRD Checkbox On EDRD Case Insert ***********************************************************************************************/ trigger CaseTrigger on Case (before insert, before update, after insert, after update) { @@ -27,6 +28,7 @@ trigger CaseTrigger on Case (before insert, before update, after insert, after u } } } + ESA_cls_caseTriggerHandler.UpdateProviderOnEDRDCase(trigger.new); } if(trigger.isBefore){