How to solve Declarative Rollup Summary - error

655    Asked by yashJaiteley in Web-development , Asked on Aug 8, 2021

I want to create a declarative Rollup Summary , but I hit the following error :

dlrs_pse_AssignmentTest.testTrigger System.DmlException: Insert failed. First exception on row 0; first error: FIELD_CUSTOM_VALIDATION_EXCEPTION, Bill Rate is required: [pse__Bill_Rate__c] Class.dlrs.RollupService.testHandler: line 282, column 1 Class.dlrs_pse_AssignmentTest.testTrigger: line 11, column 1

Scenarios is as follow


Parent object : pse__Milestone__


Child Object : pse__Assignment__c


Relationship field : pse__Milestone__c


Field to aggregate : Days_Active__c


Aggregate result field : Days_Active_Roll_Up__c

Manage child trigger :

/** * Auto Generated and Deployed by the Declarative Lookup Rollup Summaries Tool package (dlrs) **/ trigger dlrs_pse_AssignmentTrigger on pse__Assignment__c (before delete, before insert, before update, after delete, after insert, after undelete, after update) { dlrs.RollupService.triggerHandler(pse__Assignment__c.SObjectType); } /** * Auto Generated and Deployed by the Declarative Lookup Rollup Summaries Tool package (dlrs) **/ @IsTest private class dlrs_pse_AssignmentTest { @IsTest private static void testTrigger() { // Force the dlrs_pse_AssignmentTrigger to be invoked, fails the test if org config or other Apex code prevents this. dlrs.RollupService.testHandler(new pse__Assignment__c()); } }

What might be the issue? I have deactivated the validation rule but still have this error.

Answered by Michael Vaughan

The field might be set to be required at the object level in case you are facing declarative lookup rollup summaries error. You can modify the test created to comprise values for theĀ pse__Assignment__c object that is inserted in the test.

To do this, you should build the rollup in a sandbox first. Then you can edit the dlrs_pse_AssignmentTest class and modify the line

                dlrs.RollupService.testHandler(new pse__Assignment__c()); } }

to be something like

                dlrs.RollupService.testHandler(new pse__Assignment__c(pse__Bill_Rate__c = 1)); } }

Once the test passes in the sandbox, then you can deploy using a change set or other tools.



Your Answer

Interviews

Parent Categories