global static List<ffrr.RevenueContractService.ManageRevenueContractResult> create(List<ffrr.RevenueContractService.ManageRevenueContractContext> contexts)
Creates or updates revenue contracts with the source records provided. If you do not provide a revenue contract, it is first created. After that, the method does the following:
Creates performance obligations for the contract and performance obligation lines from the source records provided.
Populates the fields on the performance obligation lines related to the revenue contract, based on their field mapping definition.
Allocates revenue for all the performance obligations in the revenue contract.
Generates recognition schedules for eligible performance obligations in the revenue contract. For more information, see "About Recognition Schedules" in the Revenue Management Help.
If steps 1 or 2 fail, the entire process is rolled back. Steps 3 and 4 are optional. If either of these fail, the previous steps are not rolled back. If step 3 fails, step 4 is not performed. The ffrr__RevenueRecognitionSettings__c.ffrr__DisableSchedulesCreationFromContracts__c custom setting controls whether to stop Recognition Schedules from being generated automatically as part of the asynchronous process. It defaults to false.
Depending on the contexts that you provide, the process runs synchronously or asynchronously. See the description below. If the process runs asynchronously, you might receive an email notification once it finishes. This is determined by the value of ffrr__BatchSetting__c.ffrr__ManageRevenueContractSendEmail__c custom setting field.
List of contexts for creating or updating revenue contracts. Each context represents a single revenue contract to be created or updated. If you provide more than one context, the process runs asynchronously. If you provide a single context, the process might execute synchronously, depending on the number of source records.
Return Value
List of ManagementRevenueContractResult with a single instance.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//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.
// In this example the Revenue Contract Service is used to synchronously create a new revenue contract.
// Performance obligations corresponding to the provided source records are created in the new revenue contract.
// Fields on the performance obligation lines related to revenue contract are populated.
// Revenue is allocated for all the performance obligations in the contract.
// Finally, recognition schedules are generated for the performance obligations.
// The list of results contains a single instance of ManageRevenueContractResult.
// Only the ProcessRunId property is populated. The remaining properties are set to null.
// You can retrieve the process run record to view additional information.
fferpcore__ProcessRun__c processRun = [SELECT Id FROM fferpcore__ProcessRun__c WHERE Id = :results[0].ProcessRunId LIMIT 1];
// The process run record contains the number of records pending to be processed,
// the number of successfully processed records, the number of errors, and the start and finish time.
// If the value of the ffrr__BatchSetting__c.ffrr__ManageRevenueContractSendEmail__c custom setting field is set to true,
// you will receive an email notification once the process finishes. This is set to true by default.
// The email contains a summary of the process run and a direct link to the process run record.
// If the value of the ffrr__RevenueRecognitionSettings__c.ffrr__DisableSchedulesCreationFromContracts__c custom setting field is set to true (default is false),
// the Recognition Schedule creation process will be skipped as part of the Revenue Contract creation.
global static ffrr.RevenueContractService.PopulateResult populate(List<Id> contractIds)
Populates the fields on the Performance Obligation Line Items related to the specified Revenue Contracts based on their Field Mapping Definition. Field values on a Performance Obligation will also be updated from the Controlling Performance Obligation Line Item.
Input Parameters
Name
Type
Description
contractIds
List<Id>
The IDs of the Revenue Contract records that are related to the Performance Obligation Line Items to be populated.
Return Value
A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and the updated Performance obligations.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//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.
// In this example the Revenue Contract Service is used to update existing
// Performance Obligation Line Item Records based on their Filed Mapping Definitions.
// Retrieve the Ids of the Revenue Contracts that will be updated.
List<ffrr__RevenueContract__c> contracts = [SELECT Id FROM ffrr__RevenueContract__c WHERE ffrr__AccountName__c = 'FF'];
global static List<Id> populateFromControllingPoli(List<id> performanceObligationIds)
Populates the Performance Obligation with the values from the controlling Performance Obligation Line Item. If the controlling Performance Obligation Line Item is not set, the first one based on the Name order will be used.
Input Parameters
Name
Type
Description
performanceObligationIds
List<id>
The IDs of the Performance Obligations to be populated.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
//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.
// In this example the Revenue Contract Service is used to populate existing
// Performance Obligation records with the values from their controlling
// Performance Obligation Line Item.
// Get the Ids of all the Performance Obligations under a specific contract.
Id contractId = [Select Id from ffrr__RevenueContract__c WHERE ffrr__Description__c = 'FF Contract'LIMIT 1].Id;
List<ffrr__PerformanceObligation__c> performanceObligations = [Select Id from ffrr__PerformanceObligation__c WHERE ffrr__RevenueContract__c = :contractId ];
global static List<Id> populateFromControllingPoliFromContract(List<Id> contractIds)
Populates the Performance Obligations for the specified Revenue Contracts with the values from the controlling Performance Obligation Line Items. If the controlling Performance Obligation Line Item is not set, the first one based on the Name order will be used.
Input Parameters
Name
Type
Description
contractIds
List<Id>
The IDs of the Performance Obligations to be populated.
global static ffrr.RevenueContractService.PopulateResult populateFromSourceRecords(ffrr.RevenueContractService.PopulateContext context)
Will update the Performance Obligation Line Items that can be found linking to the given source records, and in turn the Performance Obligation from the controlling Performance Obligation Line Item. NB This uses a noticeable amount of SOQL queries, and as such should not be used where a trigger may be handling more than 1000 records. CPU time, which must be 'shared' with the calling process, may reduce that further in practice. This currently requires both sharing and CRUD access to the Performance Obligation Line Items and Performance Obligation as well as the ability to read Recognition Settings and FieldMappings.
A RevenueContractService.PopulateContext object containing the source IDs to repopulate from.
Return Value
A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and any updated Performance obligations.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//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.
// In this example the Revenue Contract Service is used to update
// any existing Performance Obligation Line Items based on the source records
// which in this case are assumed to be the Opportunities (from an Opportunity trigger).
global static ID populateFromSourceRecordsAsync(ffrr.RevenueContractService.PopulateContext context)
This will start a queuable job to update Performance Obligation Line Items based on the source records indicated. The work done will be the same as populateFromSourceRecords, except that it happens via a queuable. The aysnc nature does mean that triggers that call this will not see any errors that occur during the populate.
global static ffrr.RevenueContractService.PopulateResult populatePerformanceObligationLineItems(List<Id> performanceObligationLineItemIds)
Populates the fields of the specified Performance Obligation Line Items based on their Field Mapping Definition. If one of the specified Performance Obligation Line Items is the controlling one, then the parent Performance Obligation is updated too.
Input Parameters
Name
Type
Description
performanceObligationLineItemIds
List<Id>
The IDs of the Performance Obligation Line Items to be populated.
Return Value
A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and any updated Performance obligations.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
//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.
// In this example the Revenue Contract Service is used to update existing
// Performance Obligation Line Item Records based on their Filed Mapping Definitions.
// Retrieve the Ids of the Performance Obligation Line Items that will be updated.
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__AccountName__c = 'FF'];
global static ffrr.RevenueContractService.PopulateResult populateRelatedPerformanceObligationLineItems(List<Id> performanceObligationIds)
Populates the fields on the Performance Obligation Line Items related to the specified Performance Obligations based on their Field Mapping Definition. Field values on a Performance Obligation will also be updated from the Controlling Performance Obligation Line Item.
Input Parameters
Name
Type
Description
performanceObligationIds
List<Id>
The IDs of the Performance Obligation records that are related to the Performance Obligation Line Items to be populated.
Return Value
A RevenueContractService.PopulateResult that contains the Ids of the updated Performance Obligation Line Items and the updated Performance obligations.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
//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.
// In this example the Revenue Contract Service is used to update the related
// Performance Obligation Line Item Records, of the provided Performance Obligations,
// based on their Filed Mapping Definitions.
// Retrieve the Ids of the Performance Obligations.
List<ffrr__PerformanceObligation__c> obligations = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__AccountName__c = 'FF'];
global static void reallocatePerformanceObligations(List<Id> performanceObligationIds)
Calculates the Allocated Revenue for the supplied Performance Obligation records.
Input Parameters
Name
Type
Description
performanceObligationIds
List<Id>
The list of Performance Obligation IDs.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
//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.
// Get a subset of all the Performance Obligations to Allocate from a Revenue Contract
// e.g In a Batch execute method.
List<ffrr__PerformanceObligation__c> obligations = [SELECT Id FROM ffrr__PerformanceObligation__c WHERE ffrr__RevenueContract__c = :contractId LIMIT 200];
Map<Id, List<ffrr.RevenueContractService.PerformanceObligation>> result = ffrr.RevenueContractService.retrievePerformanceObligations(newList<Id>{contract.Id});
The save context containing the list of Performance Obligation records to be upserted, and records to be deleted.
Return Value
A POSaveResult containing the list of new and updated Performance Obligations and a POLISaveResult containing the list of new and updated Performance Obligations Line Items.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//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.
// In this example the Revenue Contract Service is used to create and update Performance Obligations, and to create and update Performance Obligation Line Items.
* This section shows how to retrieve the records for manipulation, modify them, create new records, and save the changes.
*/
// Retrieve the Performance Obligations. These will also retrieve the Performance Obligation Line Items as a list property on the Performance Obligation.
// Set the Controlling POLI on the new Line Item. This will cause the Controlling POLI to be updated to this Line Item.
// Setting 'IsControllingPOLI' on two or more Line Items belonging to the same Performance Obligation will result in an ffrr.Exceptions.AppException being thrown.
// Leaving 'IsControllingPOLI' set to NULL on all POLIs passed in will not change the Controlling POLI.
newLineItemForNewPO.AccountName = 'New Example Account';
// Set the Controlling POLI on the new Line Item. This will cause the Controlling POLI to be updated to this Line Item.
// Setting 'IsControllingPOLI' on two or more Line Items belonging to the same Performance Obligation will result in an ffrr.Exceptions.AppException being thrown.
// Leaving 'IsControllingPOLI' set to NULL on all POLIs passed in will not change the Controlling POLI.
newLineItemForNewPO.IsControllingPOLI = TRUE;
// Create a new List of Line Items on the Performance Obligation containing the new Line Item.
// Save the new and updated Performance Obligations.
ffrr.RevenueContractService.POSaveResult result = ffrr.RevenueContractService.savePerformanceObligations(saveContext);
// Query the new Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> newPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.NewRecordIds];
// Query the updated Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> updatedPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.UpdatedRecordIds];
// Query all the new and updated Performance Obligations for use later on.
List<ffrr__PerformanceObligation__c> allPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.AllRecordIds];
global static Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> searchRecords(String searchTerm)
Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE, that start with the search term in their Name Field. Maximum of 100 records for each SObject Type will be returned by default. Wildcards are supported.
Input Parameters
Name
Type
Description
searchTerm
String
The text to search for.
Return Value
A List of the records found keyed by their SObject Type.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
//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.
// In this example the Revenue Contract Service is used to search for source records that are related
// to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE.
// Specify the term that matches the names of the source records.
// This will return any source record that starts with "Project" or "project".
String searchTerm = 'Project';
// Get the references of the source records, keyed by their type, matching the search term from the result.
Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> result = ffrr.RevenueContractService.searchRecords( searchTerm );
global static Map<Schema.SObjectType, List<ffrr.ViewService.Reference>> searchRecords(String searchTerm, ffrr.RevenueContractService.RecordSearchOptions options)
Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE, that start with the search term in their Name Field. Wildcards are supported.
Searches for Records that are related to ffrr_Settings__c, where ffrr__UseInRevenueContract__c is TRUE and which are not associated with an existing Performance Obligation.
Input Parameters
Name
Type
Description
searchTerm
String
The text to search for (wildcards of '*' and '?' are supported).
objectName
String
The API name of the type of source object to search for (or '*' for all types).
filterPath
List<String>
The path (via lookups) to the field to search against (with the 'searchTerm') - this only applies with an 'objectname' to specify the starting point (otherwise the objects name field will be used).
global static List<ffrr.ViewService.Reference> searchTemplates(String searchTerm)
Searches for ffrr__Template__c records by name, whose related setting has an ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false. Returns 100 results by default.
Input Parameters
Name
Type
Description
searchTerm
String
The text to search for.
Return Value
A List of ViewService.Reference containing the Id and the name of matching results.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
//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.
// In this example the Revenue Service is used to search for recognition templates, whose related Recognition Setting has an
// ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false.
// Specify the term that matches the names of the templates.
// This will return any recognition template that contains "Percent Complete"
String searchTerm = 'Percent Complete';
// Get the references of the recognition templates matching the search term from the result.
List<ffrr.ViewService.Reference> result = ffrr.RevenueContractService.searchTemplates( searchTerm );
global static List<ffrr.ViewService.Reference> searchTemplates(String searchTerm, ffrr.RevenueContractService.RecordSearchOptions options)
Searches for ffrr__Template__c records by name, whose related setting has an ffrr__object__c of ffrr__PerformanceObligation__c and ffrr__UseInRevenueContract__c is false.
global static List<ffrr.RevenueContractService.TransferResult> transferPreviouslyRecognized(ffrr.RevenueContractService.TransferContext context)
Creates In Progress Recognition Transactions with Transaction Lines for Performance Obligation Line records provided that are related to source records with committed Transactions. Transaction Lines are only created for active Performance Obligations with valid templates.
Specifies wich records will be included in the process as well as the information that will be put on the created Transactions.
Return Value
The List of the created Recognition Transaction IDs.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//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.
// In this example the Revenue Contract Service is used to create Recognition Transactions
// for specific Performance Obligation records that are related to source records with committed Transactions.
// Select the Performance Obligation Line Items related to the source records. Any "Committed" Revenue, no later than the cutoff date,
// will be taken into account from this proccess.
// The following selects the Performance Obligation Line Items whose related contract's start date is after the 2017-01-01.
Date startOf2017 = Date.newInstance(2017, 01, 01);
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__PerformanceObligation__r.ffrr__RevenueContract__r.ffrr__StartDate__c >= :startOf2017];
global static Id transferPreviouslyRecognizedAsync(ffrr.RevenueContractService.TransferContext context)
Creates In Progress Recognition Transactions with Transaction Lines for all Performance Obligation records that are related to source records with committed Transactions. Transaction Lines are only created for active Performance Obligations with valid templates.
The Field Mapping Definition of the Performance Obligation Line Item. This determines which fields get populated from Source Records when "Update from Source" occurs.
IncomeStatementAccount
String
The Income Statement GLA of the Performance Obligation Line Item.
IsControllingCostPOLI
Boolean
Indicates whether the Performance Obligation Line Item is the Cost Controlling Performance Obligation Line Item. The Performance Obligation will take Cost specific vaues from the Cost Controlling Performance Obligation Line Item when "Update from Source" occurs. The cost controlling POLI will only be used to populate the more general fields on the Performance Obligation in the scenario whereby a controlling revenue POLI has not be specified at all.
IsControllingPOLI
Boolean
Indicates whether the Performance Obligation Line Item is the Revenue Controlling Performance Obligation Line Item. The Performance Obligation will take Revenue specific values from the Revenue Controlling Performance Obligation Line Item when "Update from Source" occurs. The revenue controlling POLI will get priority when populating the more general fields on the Performance Obligation.
PercentageComplete
Decimal
The Percentage that this Performance Obligation Line Item is complete, using the scale of 100 to denote 100%.
PerformanceObligationId
Id
The ID of the Performance Obligation this Performance Obligation Line Item belongs to.
Revenue
Decimal
The Revenue for the Performance Obligation Line Item.
// Save the new and updated Performance Obligations.
ffrr.RevenueContractService.POSaveResult result = ffrr.RevenueContractService.savePerformanceObligations(saveContext);
// Query the new Performance Obligations.
List<ffrr__PerformanceObligation__c> newPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.NewRecordIds];
// Query the updated Performance Obligations.
List<ffrr__PerformanceObligation__c> updatedPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.UpdatedRecordIds];
// Query all the new and updated Performance Obligations.
List<ffrr__PerformanceObligation__c> allPerformanceObligations = [SELECT Id, ffrr__SSPOverride__c FROM ffrr__PerformanceObligation__c WHERE ID IN :result.AllRecordIds];
// Query the new Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> newPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.NewRecordIds];
// Query the updated Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> updatedPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.UpdatedRecordIds];
// Query all the new and updated Performance Obligation Line Items.
List<ffrr__PerformanceObligationLineItem__c> allPerformanceObligationLineItems = [SELECT Id, ffrr__AccountName__c FROM ffrr__PerformanceObligationLineItem__c WHERE ID IN :lineItemResult.AllRecordIds];
All Performance Obligations related to this contract
PerformanceObligationsCount
Decimal
The number of Performance Obligations on this Contract
Revenue
Decimal
The value that will be allocated to the Performance Obligations. Uses Total Revenue, or Revenue Override if populated
RevenueAllocated
Boolean
Indicates if the Revenue for this contract has been allocated successfully
RevenueRecognitionComplete
Boolean
Indicates whether this Revenue Contract is complete
SourceRecordId
Id
ID of the source record that the revenue contract relates to. This is mapped to the lookup field defined in the ffrr__RevenueRecognitionSettings__c.ffrr__RevenueContractSourceRecordLookup__c custom setting field.
StartDate
Date
The start date of the Revenue Contract
EndDate
Date
The end date of this Revenue Contract
TotalAllocatedRevenue
Decimal
Total Allocated Revenue for this Revenue Contract
TotalAllocatedRevenueOverride
Decimal
Sum of Allocated Revenue Override values from all linked Performance Obligations
TotalAmortizedToDate
Decimal
Total Cost Recognized To Date for this Revenue Contract
TotalCost
Decimal
Total cost for this Revenue Contract
TotalRecognizedToDate
Decimal
Total Revenue Recognized To Date for this Revenue Contract
TotalSSP
Decimal
Sum of Standalone Selling Prices from all linked Performance Obligations
Represents the revenue contract record to be created or updated. Optional when creating a revenue contract, required when updating a revenue contract. If you are creating a new revenue contract, you can provide the following properties: - AccountId - Description - CurrencyIsoCode - SourceRecordId - StartDate - EndDate If you are updating a revenue contract, you must provide the Id property. Any other properties that you might provide are ignored.
SourceRecordIds
List<Id>
List of source records used to create performance obligations and performance obligation lines for the revenue contract. If you call the ffrr__RevenueContractService.create method with a single context, the number of source records determines whether the process runs synchronously or asynchronously. This is determined based on the value of the ffrr__BatchSetting__c.ffrr__ManageRevenueContractSynchronousLimit__c custom setting field. Note that the source records must not be linked to performance obligation lines in another revenue contract. If a source record is linked to a performance obligation line in the specified revenue contract, it is ignored.
fieldMappingDefinitionId
Id
Id of Field Mapping Definition that will be used to do any additional field mapping between fields on the contract source record and the Revenue Contract to be created. If an update call and a previous field mapping has been used, the update will overwrite the previously mapped values and will apply any additional field mappings. If this value is null then no additional mapping will take place The Field Mapping Definition must have source object type equal to that of the contract source record, and it must have target object type equal to the RevenueContract__c object type
global with sharing class ManageRevenueContractResult
Contains information resulting from the create or update revenue contract process. Different properties are populated depending on whether the process runs synchronously or asynchronously.
Properties
Name
Type
Description
Errors
List<String>
List of errors that occurred during the synchronous process. Null if no errors occurred or when the process runs asynchronously.
ProcessRunId
Id
ID of the related fferpcore__ProcessRun__c record when the process runs asynchronously. You can query the process run to view the status of the execution, the related child process runs, and the related logs. For more information, see "fferpcore.ffasync_ProcessService" in the Foundations Apex API Developer Reference documentation. Null when the process is executed synchronously.
Represents the revenue contract that was created or updated synchronously. The PerformanceObligations property only contains the performance obligations that were created, existing obligations are excluded. The PerformanceObligationsCount property contains the total number of performance obligations in the revenue contract, including existing obligations. Null when the process runs asynchronously.
Status
String
Final status of the synchronous process. Set to one of the following: - "Error" - Value of the ffrr__AllocationStatus__c field of the revenue contract Null when the process runs asynchronously.
@decription The context in which the Transfer Previously Recognized process will be executed.
Sample Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
//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 Transfer context to specify how the Transfer Previously Recognized process
// will be executed.
// Select the period the Recognition Transaction will be created for.
Date recognitionDate = Date.newInstance(2016, 1, 1);
List<ffrr__RecognitionPeriod__c> periods = [SELECT Id FROM ffrr__RecognitionPeriod__c WHERE ffrr__StartDate__c <= :recognitionDate AND ffrr__EndDate__c >= :recognitionDate];
// Select an "In Progress" Transaction to Update.
List<ffrr__RevenueRecognitionTransaction__c> transactions = [SELECT Id FROM ffrr__RevenueRecognitionTransaction__c WHERE ffrr__Status__c = 'In Progress'AND ffrr__Description__c = 'Certinia'LIMIT 1];
List<Id> transactionIds = newList<Id>();
for( ffrr__RevenueRecognitionTransaction__c trans : transactions )
{
transactionIds.add(trans.Id);
}
// Select the Performance Obligation Line Items related to the source records. Any "Committed" Revenue to be used
// Recognition Transaction related to those source records will be taken into account from this proccess.
Date startOf2017 = Date.newInstance(2017, 01, 01);
List<ffrr__PerformanceObligationLineItem__c> lineItems = [SELECT Id FROM ffrr__PerformanceObligationLineItem__c WHERE ffrr__PerformanceObligation__r.ffrr__RevenueContract__r.ffrr__StartDate__c >= :startOf2017];
Specifies the committed Recognition Transactions that will be used from the Transfer Process. Only committed Transactions where the Recognition Date is up to the cutoff date will be used.
Description
String
The description on the created transaction.
LegislationType
String
The legislation type on the created transaction.
PerformanceObligationLineItems
List<Id>
The Performance Obligation Lines related to source records with committed Transactions that will be used by the process. (Optional)
Period
String
The recognition period the transactions will be created for.
RecognitionDate
Date
The recognition date the transactions will be created for.
TransactionIds
List<Id>
Specifies transactions to be amended with Transaction Lines. (Optional) New Transaction Lines created from the Performance Obligation Line Items specified will be amended to the given Transactions of the same currency. The Transactions specified in this list must be of different currencies.