ffrr.GroupingServiceglobal with sharing class GroupingService Class containing information regarding grouping source records. Methods
createglobal static ffrr.GroupingService.GroupingResult create(ffrr.GroupingService.GroupingContext context, ffrr.GroupingService.GroupingOptions options) Creates Grouping Records from Staging Records for the Level 1 criteria provided. Specifying a Grouping RecordID will create Grouping records that relate to that grouping record. Input Parameters
Return ValueA GroupingResult object containing a list of IDs for created grouping records if a Synchronous process was run or a batch ID if an Asynchronous process ran. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Create new GroupingCriteria to configure which fields // will be used to group the source records. // Specify the level of the source records this grouping should apply to. Integer level = 1; // Specify the SObjectType of the source records to be grouped. Schema.SObjectType objectType = Account.getSObjectType(); // Specify the fields that will be used for grouping. List<Schema.SObjectField> objectFields = new List<Schema.SObjectField>(); objectFields.add(Account.Rating); // Create the GroupingCriteria. ffrr.GroupingService.GroupingCriteria criteria = new ffrr.GroupingService.GroupingCriteria(level, objectType, objectFields); // Create a new GroupingContext ffrr.GroupingService.GroupingContext context = new ffrr.GroupingService.GroupingContext(); // Add the GroupingCriteria context.GroupingCriteria = new List<ffrr.GroupingService.GroupingCriteria>{criteria}; // set the VersionId or GroupingRecordIds context.VersionId = [SELECT Id FROM ffrr__StagingVersion__c LIMIT 1].Id; // Or context.GroupingRecordIds = new List<Id>{[SELECT Id FROM ffrr__GroupingSummary__c LIMIT 1].Id}; // add the optional StagingSummary__c IDs and/or StagingDetail__c IDs that limit // the creation of grouping records to only grouping these records // If you set either StagingSummaryIds or StagingDetailIds to null, all relevant Summaries or Details will be selected. // If set as a list, only relevant records within the list will be selected. An empty list will result in no Summaries or Details selected. Map<Id, ffrr__StagingSummary__c> summariesById = new Map<Id, ffrr__StagingSummary__c>([SELECT Id FROM ffrr__StagingSummary__c LIMIT 100]); context.StagingSummaryIds = new List<Id>(summariesById.keySet()); Map<Id, ffrr__StagingDetail__c> detailsById = new Map<Id, ffrr__StagingDetail__c>([SELECT Id FROM ffrr__StagingDetail__c LIMIT 100]); context.StagingDetailIds = new List<Id>(detailsById.keySet()); // Create GroupingOptions ffrr.GroupingService.GroupingOptions options = new ffrr.GroupingService.GroupingOptions(); // Create GroupingResult ffrr.GroupingService.GroupingResult result = ffrr.GroupingService.create(context, options); deleteRecordsglobal static ffrr.GroupingService.DeleteResult deleteRecords(List<ffrr.GroupingService.DeleteCriteria> criteria, ffrr.GroupingService.DeleteOptions options) Delete the Grouping data that matches the criteria within the given context. The TransactionType can be specified within the options. Input Parameters
Return ValueDelete result object containing the ID of the DeleteGroupingBatch, if one was started. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Obtain the ID of a user. Id userId = [SELECT Id FROM User WHERE FirstName = 'Peter' LIMIT 1].Id; ffrr.GroupingService.DeleteOptions options = new ffrr.GroupingService.DeleteOptions(); // Specify the desired transaction type. options.TransactionType = ffrr.CommonService.ApexTransactionType.Dynamic; // Create criteria for the user. ffrr.GroupingService.DeleteCriteria criteria = new ffrr.GroupingService.DeleteCriteria(); criteria.Users = new List<Id>{userId}; List<ffrr.GroupingService.DeleteCriteria> criteriaList = new List<ffrr.GroupingService.DeleteCriteria>{criteria}; // Invoke the method. ffrr.GroupingService.deleteRecords(criteriaList, options); retrieveglobal static List<ffrr.GroupingService.GroupingSummary> retrieve(Id groupingRecordId, Id versionId) Retrieves the Grouping Summary records created from summary information in the Staging Table. Input Parameters
Return ValueA list of GroupingService.GroupingSummary records containing the grouping information. ffrr.GroupingService.DeleteCriteriaglobal with sharing class DeleteCriteria Criteria to select which records are deleted within a delete operation. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Create a criteria. ffrr.GroupingService.DeleteCriteria criteria = new ffrr.GroupingService.DeleteCriteria(); // Obtain the ID of the current user Id userId = UserInfo.getUserId(); // Set the user parameter on the criteria. This can be any list of User IDs. // If specified, it will only delete records belonging to those users. criteria.Users = new List<Id>{userId}; // Obtain a list of versions to delete. Map<Id, ffrr__StagingVersion__c> versionsById = new Map<Id, ffrr__StagingVersion__c>( [SELECT Id FROM ffrr__StagingVersion__c LIMIT 5] ); criteria.Versions = new List<Id>(versionsById.keySet()); // Only delete versions where ffrr__IsLatest__c is false. criteria.KeepLatestVersions = true; Properties
MethodsDeleteCriteriaglobal DeleteCriteria() ffrr.GroupingService.DeleteOptionsglobal with sharing class DeleteOptions Options to influence how a delete operation is performed. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Create new delete options. ffrr.GroupingService.DeleteOptions options = new ffrr.GroupingService.DeleteOptions(); // Specify the desired transaction type. options.TransactionType = ffrr.CommonService.ApexTransactionType.DYNAMIC; Properties
MethodsDeleteOptionsglobal DeleteOptions() ffrr.GroupingService.DeleteResultglobal with sharing class DeleteResult Container for data resulting from a delete operation. Properties
MethodsDeleteResultglobal DeleteResult() ffrr.GroupingService.GroupingContextglobal with sharing class GroupingContext Contains information from which to create Grouping Records. Sample Code//Note: This sample code is for demonstration purposes only. It is not intended for //use in a production environment, is not guaranteed against defects or errors, and //is in no way optimized or streamlined. // Create a new GroupingContext ffrr.GroupingService.GroupingContext context = new ffrr.GroupingService.GroupingContext(); // set the VersionId or GroupingRecordIds context.VersionId = [SELECT Id FROM ffrr__StagingVersion__c LIMIT 1].Id; // Or context.GroupingRecordIds = new List<Id>{[SELECT Id FROM ffrr__GroupingSummary__c LIMIT 1].Id}; // Add the GroupingCriteria context.GroupingCriteria = new List<ffrr.GroupingService.GroupingCriteria>{ new ffrr.GroupingService.GroupingCriteria(1, Account.getSObjectType(), new List<Schema.SObjectField>{Account.Rating}) }; // add the optional StagingSummary__c IDs and/or StagingDetail__c IDs that limit // the creation of grouping records to only grouping these records. // NOTE: If you set either StagingSummaryIds or StagingDetailIds to null, all relevant Summaries or Details will be selected. // If set as a list, only relevant records within the list will be selected. An empty list will result in no Summaries or Details selected. Map<Id, ffrr__StagingSummary__c> summariesById = new Map<Id, ffrr__StagingSummary__c>([SELECT Id FROM ffrr__StagingSummary__c LIMIT 100]); context.StagingSummaryIds = new List<Id>(summariesById.keySet()); Map<Id, ffrr__StagingDetail__c> detailsById = new Map<Id, ffrr__StagingDetail__c>([SELECT Id FROM ffrr__StagingDetail__c LIMIT 100]); context.StagingDetailIds = new List<Id>(detailsById.keySet()); Properties
MethodsGroupingContextglobal GroupingContext() ffrr.GroupingService.GroupingCriteriaglobal with sharing class GroupingCriteria Contains the criteria related to grouping from staging records. Properties
Methods
GroupingCriteriaglobal GroupingCriteria() GroupingCriteriaglobal GroupingCriteria(Integer level, Schema.SObjectType SObjectType, List<Schema.SObjectField> SObjectFields) ffrr.GroupingService.GroupingOptionsglobal with sharing class GroupingOptions Enables you to set options relating to grouping operations. Properties
MethodsGroupingOptionsglobal GroupingOptions() ffrr.GroupingService.GroupingResultglobal with sharing class GroupingResult Container for data resulting from a Grouping operation. Properties
ffrr.GroupingService.GroupingSummaryglobal with sharing class GroupingSummary Contains the information of a Grouping Summary record. Properties
MethodsGroupingSummaryglobal GroupingSummary() |