Skip to content

Commit

Permalink
Merge pull request #231 from jondavis9898/issue229-extra-contexts-whe…
Browse files Browse the repository at this point in the history
…n-case-different

Issue #229 - Ensure context is shared when rollups differ by case only
  • Loading branch information
afawcett committed Aug 27, 2015
2 parents 6a4f011 + d1eb2a1 commit 80406ca
Show file tree
Hide file tree
Showing 3 changed files with 1,072 additions and 1 deletion.
7 changes: 6 additions & 1 deletion rolluptool/src/classes/RollupService.cls
Original file line number Diff line number Diff line change
Expand Up @@ -765,7 +765,12 @@ global with sharing class RollupService
// Determine if an LREngine Context has been created for this parent child relationship, filter combination or underlying query type and sharing mode?
String rsfType = rsf.isAggregateBasedRollup() ? 'aggregate' : 'query';
String orderBy = String.isBlank(Lookup.FieldToOrderBy__c) ? '' : Lookup.FieldToOrderBy__c;
String contextKey = lookup.ParentObject__c + '#' + lookup.RelationshipField__c + '#' + lookup.RelationShipCriteria__c + '#' + rsfType + '#' + sharingMode + '#' + orderBy;
// Lowering case on Describable fields is only required for Legacy purposes since LookupRollupSummary__c records
// will be updated with describe names on insert/update moving forward.
// Ideally this would not be needed to save CPU cycles but including to ensure context is properly re-used when possible for
// rollups that have not been updated/inserted after the insert/update enhancement is applied
// Unable to lower RelationShipCriteria__c because of field value case-(in)sensitivity configuration
String contextKey = lookup.ParentObject__c.toLowerCase() + '#' + lookup.RelationshipField__c.toLowerCase() + '#' + lookup.RelationShipCriteria__c + '#' + rsfType + '#' + sharingMode + '#' + orderBy.toLowerCase();

LREngine.Context lreContext = engineCtxByParentRelationship.get(contextKey);
if(lreContext==null)
Expand Down
Loading

0 comments on commit 80406ca

Please sign in to comment.