diff --git a/rolluptool/src/classes/LREngine.cls b/rolluptool/src/classes/LREngine.cls index e84f7fea..57030163 100644 --- a/rolluptool/src/classes/LREngine.cls +++ b/rolluptool/src/classes/LREngine.cls @@ -129,8 +129,9 @@ public class LREngine { // Zero rollups for unprocessed master records (those with no longer any child relationships) for(Id masterRecId : masterIds) - for (String detailFld : detail2MasterFldMap.keySet()) - masterRecordsMap.get(masterRecId).put(detail2MasterFldMap.get(detailFld), 0); + for (RollupSummaryField rsf : ctx.fieldsToRoll) + masterRecordsMap.get(masterRecId).put(rsf.master.getName(), + rsf.isMasterTypeNumber ? 0 : null); return masterRecordsMap.values(); } diff --git a/rolluptool/src/classes/RollupService.cls b/rolluptool/src/classes/RollupService.cls index 5f9e8216..fbf9e89b 100644 --- a/rolluptool/src/classes/RollupService.cls +++ b/rolluptool/src/classes/RollupService.cls @@ -45,6 +45,10 @@ global with sharing class RollupService LookupRollupSummary__c lookup = lookups[0]; if(lookup.CalculateJobId__c!=null) throw RollupServiceException.jobAlreadyRunning(lookup.Name); + + // Already active? + if(!lookup.Active__c) + throw new RollupServiceException('The rollup must be Active before you can run a Calculate job.'); // Start the job and record the Job Id Integer scopeSize = (Integer) DeclarativeLookupRollupSummaries__c.getInstance().CalculateJobScopeSize__c; @@ -207,7 +211,7 @@ global with sharing class RollupService // Rollup child records and update master records if(lookupsToProcess.size()>0) - update updateMasterRollupsTrigger(lookups, masterRecordIds); + updateRecords(updateMasterRollupsTrigger(lookups, masterRecordIds), false, true); return; } @@ -217,7 +221,7 @@ global with sharing class RollupService for(LookupRollupSummary__c lookup : lookups) if(childRecord.get(lookup.RelationShipField__c)!=null) masterRecordIds.add((Id)childRecord.get(lookup.RelationShipField__c)); - update updateMasterRollupsTrigger(lookups, masterRecordIds); + updateRecords(updateMasterRollupsTrigger(lookups, masterRecordIds), false, true); } /** @@ -301,7 +305,7 @@ global with sharing class RollupService // Update master records List rollupSummaryLogs = new List(); List masterRecordList = masterRecords.values(); - List saveResults = Database.update(masterRecordList, false); + List saveResults = updateRecords(masterRecordList, false, false); // Log errors to the summary log Integer masterRecordIdx = 0; @@ -373,7 +377,7 @@ global with sharing class RollupService // Update master records List masterRecordList = masterRecords.values(); - List saveResults = Database.update(masterRecordList, false); + List saveResults = updateRecords(masterRecordList, false, false); // Log errors to the summary log Integer masterRecordIdx = 0; @@ -549,5 +553,48 @@ global with sharing class RollupService RollupSummaries.OPERATION_PICKLIST_TO_ENUMS.get(lookup.AggregateOperation__c))); } return engineCtxByParentRelationship; - } + } + + /** + * Wrapper around DML allowing with or without sharing to be applied and all or nothing exception handling + **/ + private static List updateRecords(List masterRecords, Boolean withSharing, Boolean allOrNothing) + { + return withSharing ? + new UpdateWithSharing(masterRecords).updateRecords(allOrNothing) : + new UpdateWithoutSharing(masterRecords).updateRecords(allOrNothing); + } + + private virtual class Updater + { + protected List masterRecords; + + public Updater(List masterRecords) + { + this.masterRecords = masterRecords; + } + + public virtual List updateRecords(boolean allOrNothing) + { + return Database.update(masterRecords, allOrNothing); + } + } + + private with sharing class UpdateWithSharing extends Updater + { + public UpdateWithSharing(List masterRecords) + { super(masterRecords); } + + public override List updateRecords(boolean allOrNothing) + { return super.updateRecords(allOrNothing); } + } + + private without sharing class UpdateWithoutSharing extends Updater + { + public UpdateWithoutSharing(List masterRecords) + { super(masterRecords); } + + public override List updateRecords(boolean allOrNothing) + { return super.updateRecords(allOrNothing); } + } } \ No newline at end of file diff --git a/rolluptool/src/classes/RollupServiceTest3.cls b/rolluptool/src/classes/RollupServiceTest3.cls index 493895d5..55b53325 100644 --- a/rolluptool/src/classes/RollupServiceTest3.cls +++ b/rolluptool/src/classes/RollupServiceTest3.cls @@ -127,6 +127,72 @@ private with sharing class RollupServiceTest3 System.assertEquals(1, logs.size()); System.assertEquals('The answer is not 42! : FIELD_CUSTOM_VALIDATION_EXCEPTION (dlrs__Total__c)', logs[0].ErrorMessage__c); } + + private testmethod static void testCalculateJobNotActive() + { + // Test supported? + if(!TestContext.isSupported()) + return; + + // Insert parents + Schema.SObjectType parentType = Schema.getGlobalDescribe().get('dlrs__LookupParent__c'); + SObject parentA = parentType.newSObject(); + parentA.put('Name', 'ParentA'); + SObject parentB = parentType.newSObject(); + parentB.put('Name', 'ParentB'); + SObject parentC = parentType.newSObject(); + parentC.put('Name', 'ParentC'); + List parents = new List { parentA, parentB, parentC }; + insert parents; + + // Insert children + Schema.SObjectType childType = Schema.getGlobalDescribe().get('dlrs__LookupChild__c'); + List children = new List(); + for(SObject parent : parents) + { + String name = (String) parent.get('Name'); + SObject child1 = childType.newSObject(); + child1.put('dlrs__LookupParent__c', parent.Id); + child1.put('dlrs__Amount__c', 20); + children.add(child1); + SObject child2 = childType.newSObject(); + child2.put('dlrs__LookupParent__c', parent.Id); + child2.put('dlrs__Amount__c', 20); + children.add(child2); + if(name.equals('ParentA') || name.equals('ParentB')) + { + SObject child3 = childType.newSObject(); + child3.put('dlrs__LookupParent__c', parent.Id); + child3.put('dlrs__Amount__c', 2); + children.add(child3); + } + } + insert children; + + // Create rollup AFTER the data exists + LookupRollupSummary__c rollupSummary = new LookupRollupSummary__c(); + rollupSummary.Name = 'Test Rollup'; + rollupSummary.ParentObject__c = 'dlrs__LookupParent__c'; + rollupSummary.ChildObject__c = 'dlrs__LookupChild__c'; + rollupSummary.RelationShipField__c = 'dlrs__LookupParent__c'; + rollupSummary.FieldToAggregate__c = 'dlrs__Amount__c'; + rollupSummary.AggregateOperation__c = RollupSummaries.AggregateOperation.Sum.name(); + rollupSummary.AggregateResultField__c = 'dlrs__Total__c'; + rollupSummary.Active__c = false; + rollupSummary.CalculationMode__c = 'Scheduled'; + insert rollupSummary; + + // Run rollup calculate job + Test.startTest(); + try { + // Assert not possible to start another + RollupService.runJobToCalculate(rollupSummary.Id); + System.assert(false, 'Expected an exception'); + } catch (Exception e) { + System.assert(e.getMessage().equals('The rollup must be Active before you can run a Calculate job.')); + } + Test.stopTest(); + } private testmethod static void testDeveloperAPI() { @@ -204,4 +270,185 @@ private with sharing class RollupServiceTest3 System.assertEquals(42, (Decimal) assertParents.get(parentB.id).get('dlrs__Total__c')); System.assertEquals(40, (Decimal) assertParents.get(parentC.id).get('dlrs__Total__c')); } + + + /** + * https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/23 + */ + private testmethod static void testDateRollupDeleteChild() + { + // Test supported? + if(!TestContext.isSupported()) + return; + + // Configure rollup + LookupRollupSummary__c rollupSummary = new LookupRollupSummary__c(); + rollupSummary.Name = 'Total Opportunities greater than 200 into Annual Revenue on Account'; + rollupSummary.ParentObject__c = 'Account'; + rollupSummary.ChildObject__c = 'Opportunity'; + rollupSummary.RelationShipField__c = 'AccountId'; + rollupSummary.RelationShipCriteria__c = null; + rollupSummary.FieldToAggregate__c = 'CloseDate'; + rollupSummary.AggregateOperation__c = 'Max'; + rollupSummary.AggregateResultField__c = 'SLAExpirationDate__c'; + rollupSummary.Active__c = true; + rollupSummary.CalculationMode__c = 'Realtime'; + insert new List { rollupSummary }; + + // Test data + Account account = new Account(); + account.Name = 'Test Account'; + account.AnnualRevenue = 0; + insert account; + Opportunity opp = new Opportunity(); + opp.Name = 'Test Opportunity'; + opp.StageName = 'Open'; + opp.CloseDate = System.today(); + opp.AccountId = account.Id; + opp.Amount = 100; + insert opp; + + // Assert rollup + Id accountId = account.Id; + System.assertEquals(System.today(), Database.query('select SLAExpirationDate__c from Account where Id = :accountId')[0].get(ACCOUNT_SLA_EXPIRATION_DATE)); + + // Delete Opportunity + delete opp; + + // Assert rollup + System.assertEquals(null, Database.query('select SLAExpirationDate__c from Account where Id = :accountId')[0].get(ACCOUNT_SLA_EXPIRATION_DATE)); + } + + /** + * https://github.com/afawcett/declarative-lookup-rollup-summaries/issues/23 + */ + private testmethod static void testDateRollupInsertConditionalChild() + { + // Test supported? + if(!TestContext.isSupported()) + return; + + // Configure rollup + LookupRollupSummary__c rollupSummary = new LookupRollupSummary__c(); + rollupSummary.Name = 'Total Opportunities greater than 200 into Annual Revenue on Account'; + rollupSummary.ParentObject__c = 'Account'; + rollupSummary.ChildObject__c = 'Opportunity'; + rollupSummary.RelationShipField__c = 'AccountId'; + rollupSummary.RelationShipCriteria__c = 'CloseDate < TODAY'; + rollupSummary.FieldToAggregate__c = 'CloseDate'; + rollupSummary.AggregateOperation__c = 'Max'; + rollupSummary.AggregateResultField__c = 'SLAExpirationDate__c'; + rollupSummary.Active__c = true; + rollupSummary.CalculationMode__c = 'Realtime'; + insert new List { rollupSummary }; + + // Test data + Account account = new Account(); + account.Name = 'Test Account'; + account.AnnualRevenue = 0; + insert account; + Opportunity opp = new Opportunity(); + opp.Name = 'Test Opportunity'; + opp.StageName = 'Open'; + opp.CloseDate = System.today(); + opp.AccountId = account.Id; + opp.Amount = 100; + insert opp; + + // Assert rollup + Id accountId = account.Id; + System.assertEquals(null, Database.query('select SLAExpirationDate__c from Account where Id = :accountId')[0].get(ACCOUNT_SLA_EXPIRATION_DATE)); + + // Delete Opportunity + delete opp; + + // Assert rollup + System.assertEquals(null, Database.query('select SLAExpirationDate__c from Account where Id = :accountId')[0].get(ACCOUNT_SLA_EXPIRATION_DATE)); + } + + private testmethod static void testRollupWithInAccessibleParent() + { + // Test supported? + if(!TestContext.isSupported()) + return; + + // Configure rollup + LookupRollupSummary__c rollupSummary = new LookupRollupSummary__c(); + rollupSummary.Name = 'Test Rollup'; + rollupSummary.ParentObject__c = 'dlrs__LookupParent__c'; + rollupSummary.ChildObject__c = 'dlrs__LookupChild__c'; + rollupSummary.RelationShipField__c = 'dlrs__LookupParent__c'; + rollupSummary.FieldToAggregate__c = 'dlrs__Amount__c'; + rollupSummary.AggregateOperation__c = RollupSummaries.AggregateOperation.Sum.name(); + rollupSummary.AggregateResultField__c = 'dlrs__Total__c'; + rollupSummary.Active__c = true; + rollupSummary.CalculationMode__c = 'Realtime'; + insert rollupSummary; + + // Insert parents + Schema.SObjectType parentType = Schema.getGlobalDescribe().get('dlrs__LookupParent__c'); + SObject parentA = parentType.newSObject(); + parentA.put('Name', 'ParentA'); + insert parentA; + + // Insert children + Schema.SObjectType childType = Schema.getGlobalDescribe().get('dlrs__LookupChild__c'); + SObject child1 = childType.newSObject(); + child1.put('dlrs__LookupParent__c', parentA.Id); + insert child1; + + // Assert rollup + Map assertParents = new Map(Database.query('select id, dlrs__Total__c from dlrs__LookupParent__c')); + System.assertEquals(null, (Decimal) assertParents.get(parentA.id).get('dlrs__Total__c')); + + // Create test user + User testUser = null; + System.runAs ( new User(Id = UserInfo.getUserId()) ) { + testUser = createUser(); + } + + // Test data insert children as new user (who cannot see the parent) + System.runAs(testUser) + { + // Ensure this user can read it (the Sharing setting for LookupParent__c is Public Read Only) + assertParents = new Map(Database.query('select id, dlrs__Total__c from dlrs__LookupParent__c')); + System.assertEquals(null, (Decimal) assertParents.get(parentA.id).get('dlrs__Total__c')); + + // Attempt to indirectly via rollup trigger to update parent record + child1.put('dlrs__Amount__c', 42); + update child1; + } + + // Assert rollup + assertParents = new Map(Database.query('select id, dlrs__Total__c from dlrs__LookupParent__c')); + System.assertEquals(42, (Decimal) assertParents.get(parentA.id).get('dlrs__Total__c')); + } + + /** + * Create test user + **/ + private static User createUser() + { + // Can only proceed with test if we have a suitable profile + List testProfiles = [Select Id From Profile where Name='Standard User' limit 1]; + if(testProfiles.size()!=1) + return null; + + // Can only proceed with test if we can successfully insert a test user + String testUsername = System.now().format('yyyyMMddhhmmss') + '@testorg.com'; + User testUser = new User(Alias = 'test1', Email='testuser1@testorg.com', EmailEncodingKey='UTF-8', LastName='Testing', LanguageLocaleKey='en_US', LocaleSidKey='en_US', ProfileId = testProfiles[0].Id, TimeZoneSidKey='America/Los_Angeles', UserName=testUsername); + try { + insert testUser; + + // Assign permission sets + Set psNames = new Set { 'LookupRollupSummariesFull', 'LookupRollupSummariesTest' }; + List ps = [select Id from PermissionSet where Name in :psNames]; + insert new List { + new PermissionSetAssignment(AssigneeId = testUser.Id, PermissionSetId = ps[0].Id), + new PermissionSetAssignment(AssigneeId = testUser.Id, PermissionSetId = ps[1].Id) }; + } catch (Exception e) { + return null; + } + return testUser; + } } \ No newline at end of file diff --git a/rolluptool/src/classes/RollupSummary_NewPage_Controller.cls b/rolluptool/src/classes/RollupSummaryEnhancedController.cls similarity index 64% rename from rolluptool/src/classes/RollupSummary_NewPage_Controller.cls rename to rolluptool/src/classes/RollupSummaryEnhancedController.cls index 4761ccef..60756ac8 100644 --- a/rolluptool/src/classes/RollupSummary_NewPage_Controller.cls +++ b/rolluptool/src/classes/RollupSummaryEnhancedController.cls @@ -1,4 +1,30 @@ -public class RollupSummary_NewPage_Controller { +/** + * Copyright (c) 2013, Andrew Fawcett + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the Andrew Fawcett, nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**/ + +public class RollupSummaryEnhancedController { private ApexPages.StandardController controller {get; set;} private LookupRollupSummary__c rus; private Set numeric; @@ -75,8 +101,12 @@ public class RollupSummary_NewPage_Controller { set; } private Map gd; - public RollupSummary_NewPage_Controller(ApexPages.StandardController stdController) { + public RollupSummaryEnhancedController(ApexPages.StandardController stdController) { this.controller = stdController; + this.controller.addFields( + new String[] { + LookupRollupSummary__c.ChildObject__c.getDescribe().getName(), + LookupRollupSummary__c.RelationshipField__c.getDescribe().getName() }); this.rus = (LookupRollupSummary__c)controller.getRecord(); gd = Schema.getGlobalDescribe(); numeric = new Set(); @@ -100,23 +130,34 @@ public class RollupSummary_NewPage_Controller { } } parentObjects.sort(); - } - public void setRelationshipField() - { + } + public String getRelationshipField() { + return rus.ChildObject__c+'.'+rus.RelationshipField__c; + } + public void setRelationshipField(String value) { + rus.ChildObject__c = value; + } + public void calculateRelationshipField() { rus.RelationshipField__c = (rus!=null && String.isNotBlank(rus.ChildObject__c)?rus.ChildObject__c.substringAfter('.'):''); } - public PageReference save() { - rus.ChildObject__c = rus.ChildObject__c.substringBefore('.'); - Set childTrigger = new Set(); - childTrigger.add(rus.ChildObject__c); - Map apexTriggers = new ApexTriggersSelector().selectByName(childTrigger); - String triggerName = RollupSummaries.makeTriggerName(rus); + // trigger exists? + Boolean foundTrigger = false; + if(rus.ChildObject__c!=null) + { + rus.ChildObject__c = rus.ChildObject__c.substringBefore('.'); + Set childTrigger = new Set(); + childTrigger.add(rus.ChildObject__c); + Map apexTriggers = new ApexTriggersSelector().selectByName(childTrigger); + String triggerName = RollupSummaries.makeTriggerName(rus); + foundTrigger = apexTriggers.containsKey(triggerName); + } + Database.SaveResult sr; if((rus.CalculationMode__c == RollupSummaries.CalculationMode.Realtime.name() || rus.CalculationMode__c == RollupSummaries.CalculationMode.Scheduled.name()) && - !apexTriggers.containsKey(triggerName)) + !foundTrigger) { //we need the trigger to be created so let's create it, // and then let's set rus.Active__c = true; @@ -125,13 +166,19 @@ public class RollupSummary_NewPage_Controller { if(triggerWasDeployedSuccessfully) { //rus.Active__c = true; //Uncomment once the trigger deploying works. - sr = Database.insert(rus); + if(rus.Id!=null) + sr = Database.update(rus, false); + else + sr = Database.insert(rus, false); } } else { //rus.Active__c = true; //Uncomment once the trigger deploying works. - sr = Database.insert(rus); + if(rus.Id!=null) + sr = Database.update(rus, false); + else + sr = Database.insert(rus, false); } PageReference pageRef; if(sr.isSuccess()) diff --git a/rolluptool/src/classes/RollupSummary_NewPage_Controller.cls-meta.xml b/rolluptool/src/classes/RollupSummaryEnhancedController.cls-meta.xml similarity index 56% rename from rolluptool/src/classes/RollupSummary_NewPage_Controller.cls-meta.xml rename to rolluptool/src/classes/RollupSummaryEnhancedController.cls-meta.xml index 62b0775a..b211a092 100644 --- a/rolluptool/src/classes/RollupSummary_NewPage_Controller.cls-meta.xml +++ b/rolluptool/src/classes/RollupSummaryEnhancedController.cls-meta.xml @@ -1,4 +1,5 @@ - 28.0 - \ No newline at end of file + 28.0 + Active + diff --git a/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls b/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls new file mode 100644 index 00000000..7b78f67a --- /dev/null +++ b/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls @@ -0,0 +1,30 @@ +/** + * Copyright (c) 2013, Andrew Fawcett + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: + * + * - Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * - Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * - Neither the name of the Andrew Fawcett, nor the names of its contributors + * may be used to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +**/ + +@IsTest +private class RollupSummaryEnhancedControllerTest { + +} \ No newline at end of file diff --git a/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls-meta.xml b/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls-meta.xml new file mode 100644 index 00000000..1124945f --- /dev/null +++ b/rolluptool/src/classes/RollupSummaryEnhancedControllerTest.cls-meta.xml @@ -0,0 +1,5 @@ + + + 24.0 + Active + diff --git a/rolluptool/src/layouts/LookupChild__c-Lookup Child Layout.layout b/rolluptool/src/layouts/LookupChild__c-Lookup Child Layout.layout new file mode 100644 index 00000000..853c776f --- /dev/null +++ b/rolluptool/src/layouts/LookupChild__c-Lookup Child Layout.layout @@ -0,0 +1,63 @@ + + + + false + false + true + + + + Required + Name + + + Edit + Amount__c + + + Edit + LookupParent__c + + + + + Edit + OwnerId + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + + + + false + false + true + + + + + + false + false + false + false + false + diff --git a/rolluptool/src/layouts/LookupParent__c-Lookup Parent Layout.layout b/rolluptool/src/layouts/LookupParent__c-Lookup Parent Layout.layout new file mode 100644 index 00000000..e66a0833 --- /dev/null +++ b/rolluptool/src/layouts/LookupParent__c-Lookup Parent Layout.layout @@ -0,0 +1,63 @@ + + + + false + false + true + + + + Required + Name + + + Edit + Total__c + + + + + Edit + OwnerId + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + + + + false + false + true + + + + + + + NAME + LookupChild__c.LookupParent__c + + false + false + false + false + false + diff --git a/rolluptool/src/layouts/LookupRollupSummaryLog__c-Lookup Rollup Summary Log Layout.layout b/rolluptool/src/layouts/LookupRollupSummaryLog__c-Lookup Rollup Summary Log Layout.layout new file mode 100644 index 00000000..0512a952 --- /dev/null +++ b/rolluptool/src/layouts/LookupRollupSummaryLog__c-Lookup Rollup Summary Log Layout.layout @@ -0,0 +1,71 @@ + + + + false + false + true + + + + Required + Name + + + Required + ParentId__c + + + Edit + ErrorMessage__c + + + Edit + ParentObject__c + + + Readonly + ParentRecord__c + + + + + Edit + OwnerId + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + + + + false + false + true + + + + + + false + false + false + false + false + diff --git a/rolluptool/src/layouts/LookupRollupSummaryScheduleItems__c-Lookup Rollup Summary Queue Layout.layout b/rolluptool/src/layouts/LookupRollupSummaryScheduleItems__c-Lookup Rollup Summary Queue Layout.layout new file mode 100644 index 00000000..fc74d924 --- /dev/null +++ b/rolluptool/src/layouts/LookupRollupSummaryScheduleItems__c-Lookup Rollup Summary Queue Layout.layout @@ -0,0 +1,66 @@ + + + + false + false + true + + + + Required + Name + + + Required + LookupRollupSummary__c + + + Edit + ParentId__c + + + Required + QualifiedParentID__c + + + Readonly + ParentRecord__c + + + + + + + false + false + true + + + + Readonly + CreatedById + + + + + Readonly + LastModifiedById + + + + + + false + false + true + + + + + + false + false + false + false + false + diff --git a/rolluptool/src/layouts/LookupRollupSummary__c-Lookup Rollup Summary Layout.layout b/rolluptool/src/layouts/LookupRollupSummary__c-Lookup Rollup Summary Layout.layout index 57d0e60f..67b29090 100644 --- a/rolluptool/src/layouts/LookupRollupSummary__c-Lookup Rollup Summary Layout.layout +++ b/rolluptool/src/layouts/LookupRollupSummary__c-Lookup Rollup Summary Layout.layout @@ -1,5 +1,6 @@ + EnhancedEdit Calculate ManageChildTrigger Submit diff --git a/rolluptool/src/objects/DeclarativeLookupRollupSummaries__c.object b/rolluptool/src/objects/DeclarativeLookupRollupSummaries__c.object index 8e17a0c1..52dcdd82 100644 --- a/rolluptool/src/objects/DeclarativeLookupRollupSummaries__c.object +++ b/rolluptool/src/objects/DeclarativeLookupRollupSummaries__c.object @@ -6,6 +6,7 @@ CalculateJobScopeSize__c 100 + false false 6 @@ -17,6 +18,7 @@ ScheduledJobScopeSize__c 100 + false false 6 diff --git a/rolluptool/src/objects/LookupParent__c.object b/rolluptool/src/objects/LookupParent__c.object index 2f30befa..a062267d 100644 --- a/rolluptool/src/objects/LookupParent__c.object +++ b/rolluptool/src/objects/LookupParent__c.object @@ -54,7 +54,7 @@ Lookup Parents - ReadWrite + Read Not_42 true diff --git a/rolluptool/src/objects/LookupRollupSummaryLog__c.object b/rolluptool/src/objects/LookupRollupSummaryLog__c.object index 7631bab2..fa729d57 100644 --- a/rolluptool/src/objects/LookupRollupSummaryLog__c.object +++ b/rolluptool/src/objects/LookupRollupSummaryLog__c.object @@ -33,12 +33,14 @@ Default Deployed + false false false false false ErrorMessage__c + false false 32768 @@ -48,6 +50,7 @@ ParentId__c false + false true 18 @@ -57,6 +60,7 @@ ParentObject__c + false false 60 @@ -66,6 +70,7 @@ ParentRecord__c + false false HYPERLINK( ParentId__c , 'Parent Record') BlankAsZero diff --git a/rolluptool/src/objects/LookupRollupSummaryScheduleItems__c.object b/rolluptool/src/objects/LookupRollupSummaryScheduleItems__c.object index db2261d1..aa6bc7d6 100644 --- a/rolluptool/src/objects/LookupRollupSummaryScheduleItems__c.object +++ b/rolluptool/src/objects/LookupRollupSummaryScheduleItems__c.object @@ -33,12 +33,14 @@ Default Deployed + false false false false false LookupRollupSummary__c + false false LookupRollupSummary__c @@ -49,6 +51,7 @@ ParentId__c + false false 18 @@ -58,6 +61,7 @@ ParentRecord__c + false false HYPERLINK( ParentId__c , 'Parent Record') BlankAsZero @@ -69,6 +73,7 @@ QualifiedParentID__c false + false true 40 diff --git a/rolluptool/src/objects/LookupRollupSummary__c.object b/rolluptool/src/objects/LookupRollupSummary__c.object index 67c7d867..357fe82f 100644 --- a/rolluptool/src/objects/LookupRollupSummary__c.object +++ b/rolluptool/src/objects/LookupRollupSummary__c.object @@ -91,8 +91,9 @@ CalculateJobId__c + false false - This field is used by the system when using the Calculate button to track if a calculation job is already running. + This field is used by the system when using the Calculate button to track if a calculation job is already running. Clear this field if the system reports the calculate job is already running and you known this is not the case. 18 false @@ -157,8 +158,9 @@ RelationshipCriteriaFields__c + false false - If you have specified a relationship criteria, you must confirm the fields referenced by it here on separate lines, for example for criteria StageName = 'Won' list StageName in this field. + If you have specified a relationship criteria, you must confirm the fields referenced by it here on separate lines, for example for criteria StageName = 'Won' list StageName in this field. You do not need to specify the Field to Aggregate field however. false TextArea @@ -196,7 +198,9 @@ Text Lookup Rollup Summaries - + + EnhancedNew + ReadWrite Calculate @@ -209,6 +213,29 @@ rollupcalculate false + + EnhancedEdit + online + button + 600 + page + Enhanced Edit (Pilot) + sidebar + rollupsummaryenhanced + false + + + EnhancedNew + online + massActionButton + 600 + page + Enhanced New Lookup Rollup Summary (Pilot) + noSidebar + rollupsummaryenhancednew + false + false + ManageChildTrigger online diff --git a/rolluptool/src/package.xml b/rolluptool/src/package.xml index 93c3f0de..0e00d8df 100644 --- a/rolluptool/src/package.xml +++ b/rolluptool/src/package.xml @@ -21,6 +21,8 @@ RollupSummaries RollupSummariesSelector RollupSummariesTest + RollupSummaryEnhancedController + RollupSummaryEnhancedControllerTest RollupSummaryScheduleItemsSelector SObjectDomain SObjectDomainTest @@ -39,6 +41,8 @@ managetrigger rollupcalculate + rollupsummaryenhanced + rollupsummaryenhancednew welcome ApexPage @@ -66,9 +70,18 @@ CustomTab + LookupChild__c-Lookup Child Layout + LookupParent__c-Lookup Parent Layout + LookupRollupSummaryLog__c-Lookup Rollup Summary Log Layout + LookupRollupSummaryScheduleItems__c-Lookup Rollup Summary Queue Layout LookupRollupSummary__c-Lookup Rollup Summary Layout Layout + + LookupRollupSummariesFull + LookupRollupSummariesReadOnly + PermissionSet + jszip StaticResource diff --git a/rolluptool/src/pages/RollupSummary_NewPage.page-meta.xml b/rolluptool/src/pages/RollupSummary_NewPage.page-meta.xml deleted file mode 100644 index b633d94b..00000000 --- a/rolluptool/src/pages/RollupSummary_NewPage.page-meta.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - 28.0 - - - \ No newline at end of file diff --git a/rolluptool/src/pages/RollupSummary_NewPage.page b/rolluptool/src/pages/rollupsummaryenhanced.page similarity index 66% rename from rolluptool/src/pages/RollupSummary_NewPage.page rename to rolluptool/src/pages/rollupsummaryenhanced.page index 2f195e8d..adec343f 100644 --- a/rolluptool/src/pages/RollupSummary_NewPage.page +++ b/rolluptool/src/pages/rollupsummaryenhanced.page @@ -1,4 +1,32 @@ - + + +