ffrr.TransactionServiceglobal with sharing class TransactionService EnumsLineActionIndicates the action to be taken if existing "In Progress" transaction lines are found for the same source object and period in a transaction.
StatusThe status of the recognition transaction.
Methods
bulkCommitglobal static ffrr.TransactionService.CommitResult bulkCommit(List<Id> transactions) Commits the transactions provided. Will update the source record fields if those fields are filled in on the corresponding setting record. Input Parameters
Return ValueA CommitResult containing a list of the committed transactions. Note: This list is not in the order the transactions were provided. 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. // Note: This sample demonstrates how to call the commit method for a previously // saved transaction, and therefore relies on there being data within the system. // For the sample to run Recognition Settings, Recognition Templates and Recognition Years and Periods // should be available, and a transaction should have been correctly // saved so that it is marked as 'In Progress'. // If the data isn't available then the results should indicate // that the process couldn't be completed. // Extract any saved transactions that are currently marked as being 'In Progress' List<ffrr__RevenueRecognitionTransaction__c> savedTransactions = [Select Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__status__c = 'In Progress']; // Build the list of transaction Ids candidates to be committed. List<Id> transactionIds = new List<Id>(); for (ffrr__RevenueRecognitionTransaction__c savedTransaction : savedTransactions) { transactionIds.add(savedTransaction.Id); } // Call the commit method that will start a synchronous process // to commit the In Progress Recognition Transactions. ffrr.TransactionService.CommitResult result = ffrr.TransactionService.bulkCommit( transactionIds ); commitTransactionsglobal static Id commitTransactions(List<Id> transactionList) Commits the transactions provided. This method starts an asynchronous process. Will update the source record fields if those fields are filled in on the corresponding setting record. Input Parameters
Return ValueThe Id of the AsyncApexJob. 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. // Note: This sample demonstrates how to call the commit method for a previously // saved transaction, and therefore relies on there being data within the system. // For the sample to run Recognition Settings, Recognition Templates and Recognition Years and Periods // should be available, and a transaction should have been correctly // saved so that it is marked as 'In Progress'. // If the data isn't available then the results should indicate // that the process couldn't be completed. // Extract any saved transactions that are currently marked as being 'In Progress' List<ffrr__RevenueRecognitionTransaction__c> savedTransactions = [Select Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__status__c = 'In Progress']; // Build the list of transaction Ids candidates to be committed. List<Id> transactionIds = new List<Id>(); for (ffrr__RevenueRecognitionTransaction__c savedTransaction : savedTransactions) { transactionIds.add(savedTransaction.Id); } // Call the commit method that will start an asynchronous process // to commit the In Progress Recognition Transactions. Id commitBatchId = ffrr.TransactionService.commitTransactions( transactionIds ); discardglobal static void discard(Set<Id> transactionIds) Discards one or more Recognition Transactions. Input Parameters
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. // Note: This sample demonstrates how to call the discard method for previously // committed transactions, and therefore relies on there being data within the system. // For the sample to run Recognition Settings, Recognition Templates and Recognition Years and Periods // should be available, and a transaction should have been correctly // saved and committed so that it is marked as 'Committed'. //Query the database and retrieve all committed transactions. List<ffrr__RevenueRecognitionTransaction__c> transactionList = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'Committed']; //Create a set of Ids to be used for storing committed transaction Ids. Set<Id> committedTransactionIds = new Set<Id>(); //Pass in the transaction Ids from the List to the Set for (ffrr__RevenueRecognitionTransaction__c rrt : transactionList) { committedTransactionIds.add(rrt.Id); } //Call the method passing in the committed transaction Ids ffrr.TransactionService.discard(committedTransactionIds); retrieveglobal static List<ffrr.TransactionService.TransactionLine> retrieve(Id elementId) Retrieves a list of Committed or In Progress transactions for the specified item (for example, project or milestone). The returned data includes only the high-level details of the transaction (such as transaction status and total recognized) and not the individual transaction lines. Input Parameters
Return ValueThe List of inprogress and committed Transaction Lines related to the recordId. 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. //Note: This sample demonstrates how to call the retrieve method and therefore relies //on there being data within the system. While the sample will run without there //being any data in the system, the output will, naturally, be different. ID itemID = null; //Note: At this point the itemID variable needs to be populated with the ID of the //Revenue Recognition item to be queried. The ID will, naturally, depend on the data //setup within your system. //Call the method List<ffrr.TransactionService.TransactionLine> transactions = ffrr.TransactionService.retrieve(itemID); //Output the transactions that were retrieved for (ffrr.TransactionService.TransactionLine transactionLine : transactions) { System.debug('Transaction: ' + transactionLine); } saveglobal static Id save(ffrr.TransactionService.HeaderDetails headerDetails) Saves a recognition transaction (and associated transaction lines) with a status of "In Progress". The single supplied parameter includes both the header details for the transaction and the items that are to be included as part of the transaction. Input Parameters
Return ValueThe Id of the AsyncApexJob. 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. // Note: This sample demonstrates how to call the save method for two lines in a // single transaction, and therefore relies on there being data within the system. // For the sample to run, Recognition Settings, Recognition Templates and Recognition Years and Periods // (covering 2013) should be available. // If the data isn't available then the results should indicate that the process couldn't // be completed. // In the example it is assumed that two records to recognize exist. // (stored in variables named 'project1' and 'project2') Account project1 = new Account(); Account project2 = new Account(); // Create the header Details Record for the transaction to be saved. // See ffrr.TransactionService.HeaderDetails for more details. ffrr.TransactionService.HeaderDetails headerDetails = new ffrr.TransactionService.HeaderDetails(); headerDetails.description = 'My Transaction'; headerDetails.legislationType = 'ASC 605'; headerDetails.GroupingValue = 'North America'; headerDetails.currencyName = 'GBP'; headerDetails.recognitionDate = system.today(); headerDetails.lineAction = ffrr.TransactionService.LineAction.IGNORE; headerDetails.lineDetailsMap = new Map<Id, ffrr.TransactionService.LineDataToSave>(); headerDetails.groupName = 'Project__c'; headerDetails.period = '2013/008'; // Note: Although we have specified 'period' in the header structure above, your Org may be // configured so that Period Validation is enabled. // In this case the periodId field must be set to contain the Id of the period that // the transaction is to be recorded against. // e.g. headerDetails.periodId = myRecognitionPeriod.Id; // Note: To append lines to an existing InProgress transaction the // headerDetails.transactionId field should be filled. // // For example: // ffrr.RevenueRecognitionTransaction__c transactionToAppend = [ Select Id from ffrr.RevenueRecognitionTransaction__c where Status__c = 'in Progress' Limit 1 ]; // headerDetails.transactionId = transactionToAppend.Id; // Create the two Line Data records ( one for each of the two projects ) // and add them to the transaction Header Details record. // See ffrr.TransactionService.LineDataToSave for more details // Line Data for Project1 ffrr.TransactionService.LineDataToSave sampleLineData1 = new ffrr.TransactionService.LineDataToSave(); sampleLineData1.recordIdList = new List<Id>{project1.Id}; sampleLineData1.toRecognizeThisPeriod = 100.00; // Add the line to the Header Details. headerDetails.lineDetailsMap.put(project1.Id, sampleLineData1); // Line Data for Project 2 ffrr.TransactionService.LineDataToSave sampleLineData2 = new ffrr.TransactionService.LineDataToSave(); sampleLineData2.recordIdList = new List<Id>{project2.Id}; sampleLineData2.toRecognizeThisPeriod = 100.00; // Add the line to the Header Details. headerDetails.lineDetailsMap.put(project2.Id, sampleLineData2); // Call the save method that will start an asynchronous process // to create the InProgress Recognition Transaction. Id saveBatchId = ffrr.TransactionService.save( headerDetails ); saveglobal static ffrr.TransactionService.StagingSaveResult save(ffrr.TransactionService.StagingSaveContext context, ffrr.TransactionService.StagingSaveOptions options) Creates Recognition Transactions (and associated Transaction Lines) of Status "In Progress" using data from the Staging Table Records. Input Parameters
Return ValueThe StagingSaveResult containing either the Id of the AsyncJob if the process has been executed asynchronously or the created Recognition Transactions keyed by version. 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 the StagingSaveContext. ffrr.TransactionService.StagingSaveContext context = new ffrr.TransactionService.StagingSaveContext(); // Set the versions of the staging data to create Recognition Transactions for. List<ffrr__StagingVersion__c> versions = [SELECT Id FROM ffrr__StagingVersion__c WHERE ffrr__GroupName__c = 'Project__c' Limit 2]; context.versions = new List<Id>{versions[0].Id}; // Include groupings. List<ffrr__GroupingSummary__c> groupings = [SELECT Id FROM ffrr__GroupingSummary__c LIMIT 10]; context.Groupings = new List<Id>(); for(ffrr__GroupingSummary__c grouping : groupings) { context.Groupings.add(grouping.Id); } // Include summaries from another version. List<ffrr__StagingSummary__c> summaries = [SELECT Id from ffrr__StagingSummary__c WHERE ffrr__Version__c = :versions[1].Id AND ffrr__AccountName__c = 'FF']; context.Summaries = new List<Id>(); for(ffrr__StagingSummary__c summary : summaries) { context.Summaries.add(summary.Id); } // Exclude a summary from the data of the first version. ffrr__StagingSummary__c summaryToExclude = [SELECT Id FROM ffrr__StagingSummary__c WHERE ffrr__Version__c = :versions[0].Id AND ffrr__AccountName__c = 'FF']; // Exclude details from the second version. List<ffrr__StagingDetail__c> detailsToExclude = [SELECT Id FROM ffrr__StagingDetail__c WHERE ffrr__Version__c = :versions[0].Id AND ffrr__TotalRevenue__c < 100000]; context.Details = new List<Id>(); for(ffrr__StagingDetail__c detail : detailsToExclude) { context.Details.add(detail.Id); } // Create the StagingTransactionDetails that contain information to. // be included on the Recognition Transactions (see ffrr.TransactionService.StagingTransactionDetails) ffrr__RecognitionPeriod__c period = [Select Id, Name FROM ffrr__RecognitionPeriod__c WHERE ffrr__RecognitionYear__r.Name = '2016' LIMIT 1]; ffrr.TransactionService.StagingTransactionDetails version1Transaction = new ffrr.TransactionService.StagingTransactionDetails(); version1Transaction.Version = versions[0].Id; version1Transaction.PeriodName = period.Name; version1Transaction.PeriodId = period.Id; version1Transaction.Description = 'January Projects Version 1'; version1Transaction.LegislationType = 'ASC 605'; version1Transaction.CommitTransaction = true; version1Transaction.LineAction = ffrr.TransactionService.LineAction.IGNORE; version1Transaction.CreateGroupedTransactions = true; ffrr.TransactionService.StagingTransactionDetails version2Transaction = new ffrr.TransactionService.StagingTransactionDetails(); version2Transaction.Version = versions[1].Id; version2Transaction.PeriodName = period.Name; version2Transaction.PeriodId = period.Id; version2Transaction.Description = 'January Projects Version 2'; version2Transaction.LegislationType = 'ASC 605'; version2Transaction.CommitTransaction = true; version2Transaction.LineAction = ffrr.TransactionService.LineAction.IGNORE; version1Transaction.CreateGroupedTransactions = false; List<ffrr.TransactionService.StagingTransactionDetails> transactionDetails = new List<ffrr.TransactionService.StagingTransactionDetails>(); transactionDetails.add( version1Transaction ); transactionDetails.add( version2Transaction ); // Add the StagingTransactionDetails to the context. context.StagingTransactionDetails = transactionDetails; // Create the StagingSaveOptions object. ffrr.TransactionService.StagingSaveOptions options = new ffrr.TransactionService.StagingSaveOptions(); // Set the type of the Apex Transactions to be performed. // If not set the Apex Transaction Type will be defaulted to CommonService.ApexTransactionType.SYNCHRONOUS. options.TransactionType = ffrr.CommonService.ApexTransactionType.ASYNCHRONOUS; // Start the save process and get the result. ffrr.TransactionService.StagingSaveResult result = ffrr.TransactionService.save( context, options ); // Retrieve the Async Job Id from the result. Id asyncJob = result.AsyncJob; bulkSaveglobal static ffrr.TransactionService.SaveResult bulkSave(List<ffrr.TransactionService.HeaderDetails> headerDetails) Creates Transactions and TransactionLines using the provided HeaderDetails and LineDataToSave. Same as the save(HeaderDetails headerDetails) method except this will not start an asynchronous process. Input Parameters
Return ValueA SaveResult containing the List of Transaction Ids for the created Transactions. 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. // Note: This sample demonstrates how to call the save method for two lines in a // single transaction, and therefore relies on there being data within the system. // For the sample to run, Recognition Settings, Recognition Templates and Recognition Years and Periods // (covering 2013) should be available. // If the data isn't available then the results should indicate that the process couldn't // be completed. // In the example it is assumed that two records to recognize exist. // (stored in variables named 'project1' and 'project2') Account project1 = new Account(); Account project2 = new Account(); // Create the header Details Record for the transaction to be saved. // See ffrr.TransactionService.HeaderDetails for more details. ffrr.TransactionService.HeaderDetails headerDetails = new ffrr.TransactionService.HeaderDetails(); headerDetails.description = 'My Transaction'; headerDetails.legislationType = 'ASC 605'; headerDetails.currencyName = 'GBP'; headerDetails.recognitionDate = system.today(); headerDetails.lineAction = ffrr.TransactionService.LineAction.IGNORE; headerDetails.lineDetailsMap = new Map<Id, ffrr.TransactionService.LineDataToSave>(); headerDetails.groupName = 'Project__c'; headerDetails.period = '2013/008'; List<ffrr.TransactionService.HeaderDetails> headers = new List<ffrr.TransactionService.HeaderDetails>{headerDetails}; // Note: Although we have specified 'period' in the header structure above, your Org may be // configured so that Period Validation is enabled. // In this case the periodId field must be set to contain the Id of the period that // the transaction is to be recorded against. // e.g. headerDetails.periodId = myRecognitionPeriod.Id; // Note: To append lines to an existing InProgress transaction the // headerDetails.transactionId field should be filled. // // For example: // ffrr.RevenueRecognitionTransaction__c transactionToAppend = [ Select Id from ffrr.RevenueRecognitionTransaction__c where Status__c = 'in Progress' Limit 1 ]; // headerDetails.transactionId = transactionToAppend.Id; // Create the two Line Data records ( one for each of the two projects ) // and add them to the transaction Header Details record. // See ffrr.TransactionService.LineDataToSave for more details // Line Data for Project1 ffrr.TransactionService.LineDataToSave sampleLineData1 = new ffrr.TransactionService.LineDataToSave(); sampleLineData1.recordIdList = new List<Id>{project1.Id}; sampleLineData1.toRecognizeThisPeriod = 100.00; // Add the line to the Header Details. headerDetails.lineDetailsMap.put(project1.Id, sampleLineData1); // Line Data for Project 2 ffrr.TransactionService.LineDataToSave sampleLineData2 = new ffrr.TransactionService.LineDataToSave(); sampleLineData2.recordIdList = new List<Id>{project2.Id}; sampleLineData2.toRecognizeThisPeriod = 100.00; // Add the line to the Header Details. headerDetails.lineDetailsMap.put(project2.Id, sampleLineData2); // Call the save method that will start a synchronous process // to create the InProgress Recognition Transaction. ffrr.TransactionService.SaveResult result = ffrr.TransactionService.bulkSave( headers ); summarizeglobal static void summarize(Set<Id> transactionIds) Summarizes Recognition Transaction Lines into Recognition Transaction Summary records. Revenue and cost amounts are summarized by GLA Type, GLA Revenue or GLA Cost, and any fields included in the Summarization Fields field set on the Recognition Transaction Line object. If a transaction has both revenue and cost amounts, at least 4 summary records will be created (2 Income Statement and 2 Balance Sheet). NOTE: All fields included in the RTL Summarization Fields field set must exist on the Recognition Transaction Summary. Input Parameters
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. // Note: This sample demonstrates how to call the summarize method for previously // committed transactions, and therefore relies on there being data within the system. // For the sample to run, Recognition Settings, Recognition Templates and Recognition Years and Periods // should be available, and a transaction should have been correctly // saved and committed so that it is marked as 'Committed'. // Query the database and retrieve all committed transactions. List<ffrr__RevenueRecognitionTransaction__c> transactionList = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'Committed']; // Create a set of Ids to be used for storing committed transaction Ids. Set<Id> committedTransactionIds = new Map<Id, SObject>(transactionList).keySet(); // Call the method passing in the committed transaction Ids ffrr.TransactionService.summarize(committedTransactionIds); summarizeAsyncglobal static Id summarizeAsync(Set<Id> transactionIds) Summarizes Recognition Transaction Lines into Recognition Transaction Summary records. Revenue and cost amounts are summarized by GLA Type, GLA Revenue or GLA Cost, and any fields included in the Summarization Fields field set on the Recognition Transaction Line object. If a transaction has both revenue and cost amounts, at least 4 summary records will be created (2 Income Statement and 2 Balance Sheet). NOTE: All fields included in the RTL Summarization Fields field set must exist on the Recognition Transaction Summary. The total number of Recognition Transaction Lines must not exceed 50000 per batch, and a maximum of 10000 summary lines can be created per batch. Input Parameters
Return ValueReturns the ID of the Batch Apex Job. 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. // Note: This sample demonstrates how to call the summarize method for previously // committed transactions, and therefore relies on there being data within the system. // For the sample to run, Recognition Settings, Recognition Templates and Recognition Years and Periods // should be available, and a transaction should have been correctly // saved and committed so that it is marked as 'Committed'. // Query the database and retrieve all committed transactions. List<ffrr__RevenueRecognitionTransaction__c> transactionList = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'Committed']; // Create a set of Ids to be used for storing committed transaction Ids. Set<Id> committedTransactionIds = new Map<Id, SObject>(transactionList).keySet(); // Call the method passing in the committed transaction Ids ffrr.TransactionService.summarizeAsync(committedTransactionIds); ffrr.TransactionService.CommitResultglobal with sharing class CommitResult Contains the list of transactions committed by the TransactionService.bulkCommit method. Note: This list is not in the order the transaction ids were provided to the service call. Properties
ffrr.TransactionService.HeaderDetailsglobal with sharing class HeaderDetails Contains the header and line data to be used for revenue recognition. 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. // Given the following record structure: // Project 1 <- Milestone 1 <- Time Card 1 // the example demonstrates the creation of a Header // detail record containing a line data to save for // Time Card 1 record. // First the Line Data record for the source record to be recognised should be created ffrr.TransactionService.LineDataToSave sampleLineData = new ffrr.TransactionService.LineDataToSave(); // The recordIdList should contain the source record Ids // from the parent record to the record to be recognised. sampleLineData.recordIdList = new List<Id>{'a0va00000059tb8'}; //Add the Time Card 1 Id // Add the value to be recognised. sampleLineData.toRecognizeThisPeriod = 112.06; // Second create the Header Details record ffrr.TransactionService.HeaderDetails sampleHeaderDetails = new ffrr.TransactionService.HeaderDetails(); // Specify that we want to save and commit the Recognition Transaction (rather than just save) sampleHeaderDetails.commitTransaction = true; //Specify the currency that the transaction will be recognised. sampleHeaderDetails.currencyName = 'USD'; // Specify the group. This should be the Object type of the top Parent record. // In this example the Project's object type. sampleHeaderDetails.groupName = 'Project__c'; // Specify the Recognition Transaction's description sampleHeaderDetails.description= 'February Time Cards'; // Specify the Recognition Transactions's Legislation Type (Optional) sampleHeaderDetails.legislationType = 'ASC 605'; // Specify the value that this Recognition Transaction was grouped by. sampleHeaderDetails.GroupingValue = 'North America'; // Specify what we want to do with existing transaction lines // In this example if there is an existing transaction line for this record // in an InProgress Recognition Transaction a new one will not be created. sampleHeaderDetails.lineAction = ffrr.TransactionService.LineAction.IGNORE; // Specify the period and the period's Id that we're recognising against and the date of the recognition. sampleHeaderDetails.period = '02/2013'; sampleHeaderDetails.periodId = 'a0ta00000001gq2'; sampleHeaderDetails.recognitionDate = date.newInstance(2013, 3, 2); // Create a map containing our line data sampleHeaderDetails.lineDetailsMap = new Map<Id, ffrr.TransactionService.LineDataToSave>(); // Add our line data to the map. The key should be the Id of the source record that will be recognised. // In this example the Time Card's Id. // Note: We can add as many lines here as we want sampleHeaderDetails.lineDetailsMap.put('a0va00000059tb8', sampleLineData); Properties
MethodsHeaderDetailsglobal HeaderDetails() If set to true when replacing lines any amount on the old line will be transferred to the new one. This is used in a temporary fix for the transfer previously recognized process on POLIs. When we refactor this service should be removed and there should be a proper update process on existing RTs/RTLs ffrr.TransactionService.LineDataToSaveglobal with sharing class LineDataToSave Contains a single set of line data to be saved as part of a recognition transaction. This class contains deprecated items. 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. // Given the following record structure: // Project 1 <- Milestone 1 <- Time Card 1 // the example demonstrates the creation of // a line data to save for the Time Card 1 record. // Create the Line Data record ffrr.TransactionService.LineDataToSave sampleLineData = new ffrr.TransactionService.LineDataToSave(); // Fill the recordIdList with the Id of the source record to be recognised (Time Card 1 Id). sampleLineData.recordIdList = new List<Id>{'a0va00000059tb8'}; // Specify the amount to be recognised. sampleLineData.toRecognizeThisPeriod = 112.06; //Optional fields //Specify the home currency and rate ffrr.CommonService.CurrencyType homeCurrency = new ffrr.CommonService.CurrencyType(); homeCurrency.ISOCode = 'USD'; homeCurrency.Rate = 1; sampleLineData.homeCurrency = homeCurrency; //Specify the document currency and rate ffrr.CommonService.CurrencyType documentCurrency = new ffrr.CommonService.CurrencyType(); documentCurrency.ISOCode = 'CAD'; documentCurrency.Rate = 1.2354; sampleLineData.documentCurrency = documentCurrency; //Specify the dual currency and rate ffrr.CommonService.CurrencyType dualCurrency = new ffrr.CommonService.CurrencyType(); dualCurrency.ISOCode = 'AUD'; dualCurrency.Rate = 0.2362; sampleLineData.dualCurrency = dualCurrency; Properties
MethodsLineDataToSaveglobal LineDataToSave() DeprecatedThe following items are deprecated and not supported for use. We recommend that you stop using these items to avoid exceptions. Properties
ffrr.TransactionService.SaveResultglobal with sharing class SaveResult Contains the list of transactions created by the TransactionService.bulkSave method. Properties
ffrr.TransactionService.StagingSaveContextglobal with sharing class StagingSaveContext Contains details required to create Recognition Transactions and TransactionLines from the staging 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 the StagingSaveContext. ffrr.TransactionService.StagingSaveContext context = new ffrr.TransactionService.StagingSaveContext(); // Set the versions of the staging data to create Recognition Transactions for. List<ffrr__StagingVersion__c> versions = [SELECT Id FROM ffrr__StagingVersion__c WHERE ffrr__GroupName__c = 'Project__c' Limit 2]; context.versions = new List<Id>{versions[0].Id}; // Include groupings. List<ffrr__GroupingSummary__c> groupings = [SELECT Id FROM ffrr__GroupingSummary__c LIMIT 10]; context.Groupings = new List<Id>(); for(ffrr__GroupingSummary__c grouping : groupings) { context.Groupings.add(grouping.Id); } // Include summaries from another version. List<ffrr__StagingSummary__c> summaries = [SELECT Id from ffrr__StagingSummary__c WHERE ffrr__Version__c = :versions[1].Id AND ffrr__AccountName__c = 'FF']; context.Summaries = new List<Id>(); for(ffrr__StagingSummary__c summary : summaries) { context.Summaries.add(summary.Id); } // Exclude a summary from the data of the first version. ffrr__StagingSummary__c summaryToExclude = [SELECT Id FROM ffrr__StagingSummary__c WHERE ffrr__Version__c = :versions[0].Id AND ffrr__AccountName__c = 'FF']; // Exclude details from the second version. List<ffrr__StagingDetail__c> detailsToExclude = [SELECT Id FROM ffrr__StagingDetail__c WHERE ffrr__Version__c = :versions[0].Id AND ffrr__TotalRevenue__c < 100000]; context.Details = new List<Id>(); for(ffrr__StagingDetail__c detail : detailsToExclude) { context.Details.add(detail.Id); } // Create the StagingTransactionDetails that contain information to. // be included on the Recognition Transactions (see ffrr.TransactionService.StagingTransactionDetails) ffrr__RecognitionPeriod__c period = [Select Id, Name FROM ffrr__RecognitionPeriod__c WHERE ffrr__RecognitionYear__r.Name = '2016' LIMIT 1]; ffrr.TransactionService.StagingTransactionDetails version1Transaction = new ffrr.TransactionService.StagingTransactionDetails(); version1Transaction.Version = versions[0].Id; version1Transaction.PeriodName = period.Name; version1Transaction.PeriodId = period.Id; version1Transaction.Description = 'January Projects Version 1'; version1Transaction.CommitTransaction = true; version1Transaction.LineAction = ffrr.TransactionService.LineAction.IGNORE; ffrr.TransactionService.StagingTransactionDetails version2Transaction = new ffrr.TransactionService.StagingTransactionDetails(); version2Transaction.Version = versions[1].Id; version2Transaction.PeriodName = period.Name; version2Transaction.PeriodId = period.Id; version2Transaction.Description = 'January Projects Version 2'; version2Transaction.CommitTransaction = true; version2Transaction.LineAction = ffrr.TransactionService.LineAction.IGNORE; List<ffrr.TransactionService.StagingTransactionDetails> transactionDetails = new List<ffrr.TransactionService.StagingTransactionDetails>(); transactionDetails.add( version1Transaction ); transactionDetails.add( version2Transaction ); // Add the StagingTransactionDetails to the context. context.StagingTransactionDetails = transactionDetails; Properties
MethodsStagingSaveContextglobal StagingSaveContext() The hash that matches the values in the staging table. Used to query for records in the staging table to include in this save. One context per per primary grouping record will be created. We have agreed that this does not belong on the global contract and we do not want to polluted the global API. This will be moved lower down the code path and be part of the public and not global api. ffrr.TransactionService.StagingSaveOptionsglobal with sharing class StagingSaveOptions Options to specify how the save operation will be 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 the StagingSaveOptions object ffrr.TransactionService.StagingSaveOptions options = new ffrr.TransactionService.StagingSaveOptions(); // Set the type of the Apex Transactions to be performed. // If not set the Apex Transaction Type will be defaulted to CommonService.ApexTransactionType.SYNCHRONOUS options.TransactionType = ffrr.CommonService.ApexTransactionType.ASYNCHRONOUS; Properties
MethodsStagingSaveOptionsglobal StagingSaveOptions() ffrr.TransactionService.StagingSaveResultglobal with sharing class StagingSaveResult The data resulting from the Save operation Properties
MethodsStagingSaveResultglobal StagingSaveResult() ffrr.TransactionService.StagingTransactionDetailsglobal with sharing class StagingTransactionDetails Contains information that will be included on the Recognition Transaction record and additional options on how the save operation will be 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 the StagingTransactionDetails object ffrr.TransactionService.StagingTransactionDetails details = new ffrr.TransactionService.StagingTransactionDetails(); // Specify the "In Progress" Recognition Transaction that the new lines will be attached to. // If left empty a new Recognition Transaction will be created. details.TransactionId = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'In Progress' LIMIT 1][0].Id; // Specify the Version of the staging records that this transaction is for. // The period is used from the service to retrieve information about the currency, // the group name and the recognition date that will be recorded on the Recognition Transaction. details.Version = [SELECT Id FROM ffrr__StagingVersion__c WHERE ffrr__GroupName__c = 'Project__c' LIMIT 1][0].Id; // Set the period information ffrr__RecognitionPeriod__c period = [Select Id, Name FROM ffrr__RecognitionPeriod__c WHERE ffrr__RecognitionYear__r.Name = '2016' LIMIT 1]; details.PeriodName = period.Name; details.PeriodId = period.Id; // Set the description details.Description = 'February Time Cards'; // Set the Legislation Type (Optional) details.legislationType = 'ASC 605'; // Set Transactions to be created by group. For example, if grouping data by company: // When true, separate transactions will be created per company. // When false, transactions will contain details for all the companies. details.CreateGroupedTransactions = true; // Set whether or not to commit the Recognition Transaction after creating it. // If not set will be defaulted to FALSE. details.CommitTransaction = true; // Set whether or not RT lines for the same records on existing Recognition Transactions // should replace the existing RT lines. // When set to REPLACE the existing RT lines are removed and the new lines are created, // when set to IGNORE the existing RT lines are created and the new ones are ignored. // If not set it will be defaulted to ffrr.TransactionService.LineAction.REPLACE. details.LineAction = ffrr.TransactionService.LineAction.IGNORE; Properties
MethodsStagingTransactionDetailsglobal StagingTransactionDetails() ffrr.TransactionService.TransactionLineglobal with sharing class TransactionLine extends ViewService.Reference Contains the details of a recognition transaction. This class extends ffrr.ViewService.Reference 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 the TransactionLine ffrr.TransactionService.TransactionLine tlSample = new ffrr.TransactionService.TransactionLine(); //Populate the fields inherited from ffrr.ViewService.Reference tlSample.id = 'a0va00000059tb8'; tlSample.name = 'Customer Order Deposit 1762991'; //Populate the fields specific to ffrr.TransactionService.TransactionLine tlSample.amount = 500.00; tlSample.recognitionCurrency = 'USD'; tlSample.recognitionDate = date.newInstance(2013, 3, 31); tlSample.status = ffrr.TransactionService.Status.COMMITTED; Properties
MethodsTransactionLineglobal TransactionLine() |