ffrr.RetrieveAmountsRecognizedServiceglobal with sharing class RetrieveAmountsRecognizedService implements Callable Provides stateless methods related to Retrieving Recognized Amounts, implements the callable interface to support loose coupling between packages. Methods
getRecognizedBetweenglobal static Map<Id, Map<Date, Decimal>> getRecognizedBetween(Set<Id> sourceIds, Date recognizedFrom, Date recognizedTo) Provides the total revenue recognized by recognition date between the recognizedFrom and recognizedTo dates inclusive. Includes revenue on both Committed and Discarding transactions. Input Parameters
Return ValueMap of source Record Id with revenue recognized per recognition date. 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. //Arguments required to be passed into the method. Set<Id> sourceRecordIds = new Set<Id>{'a1b000000000001AAA', 'a1b000000000001AAB'}; Date startDate = Date.newInstance(2019, 01, 01); Date endDate = Date.newInstance(2019, 02, 01); //Method call with params. Map<Id, Map<Date, Decimal>> sourceRecordsIdByDate = ffrr.RetrieveAmountsRecognizedService.getRecognizedBetween(sourceRecordIds, startDate, endDate); getRecognizedCostBetweenglobal static Map<Id, Map<Date, Decimal>> getRecognizedCostBetween(Set<Id> sourceIds, Date recognizedFrom, Date recognizedTo) Provides the total cost recognized by recognition date between the recognizedFrom and recognizedTo dates inclusive. Includes cost on both Committed and Discarding transactions. Input Parameters
Return ValueMap of source Record Id with cost recognized per recognition date. 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. //Arguments required to be passed into the method. Set<Id> sourceRecordIds = new Set<Id>{'a1b000000000001AAA', 'a1b000000000001AAB'}; Date startDate = Date.newInstance(2019, 01, 01); Date endDate = Date.newInstance(2019, 02, 01); //Method call with params. Map<Id, Map<Date, Decimal>> sourceRecordsIdByDate = ffrr.RetrieveAmountsRecognizedService.getRecognizedCostBetween(sourceRecordIds, startDate, endDate); callglobal Object call(String action, Map<String, Object> args) Executes method supplied as action, with the arguments supplied in args. Input Parameters
Return ValueObject containing method output. 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. //Available callable methods are: //getRecognizedBetween - Provides the total revenue recognized by recognition date //getRecognizedCostBetween - Provides the total cost recognized by recognition date //Example usage of callable with the getRecognizedBetween method //Name of service to call method on. String extensionClass = 'ffrr.RetrieveAmountsRecognizedService'; //Name of method to call String action = 'getRecognizedBetween'; //Arguments required for method to call. Set<Id> sourceRecordIds = new Set<Id>{'a1b000000000001AAA', 'a1b000000000001AAB'}; Map<String, Object> arguments = new Map<String, Object>(); arguments.put('sourceIds', sourceRecordIds); arguments.put('recognizedFrom', Date.newInstance(2019, 01, 01)); arguments.put('recognizedTo', Date.newInstance(2019, 02, 01)); //Create RetrieveAmountsRecognizedService to be able to invoke call. Callable extension = (Callable) Type.forName(extensionClass).newInstance(); //Call the call method, passing in the method name to invoke, with the arguments required for the method. Map<Id, Map<Date, Decimal>> sourceRecordsIdByDate = (Map<Id, Map<Date, Decimal>>)extension.call(action, arguments); |