Scenario B Multiple Targets from a Single Source with Roll-up Information
In this scenario a ClickLink rule is created to generate target records from a source record. The target records also have child records. Roll-up information is generated from the child records.
Problem
You are a finance officer and want to convert expense lines to journals so that you do not have to input the information again. In this scenario each expense line contains a date, description, GLA, Dr and Cr column. For instance:
Date | Description | GLA | DR | CR |
---|---|---|---|---|
30/11/2015 | November Credit Card Expenses VJG | Subscriptions | 100.00 | |
30/11/2015 | November Credit Card Expenses VJG | Office Stationery | 100.00 | |
30/11/2015 | November Credit Card Expenses VJG | Credit Card Control Account | 200.00 | |
30/11/2015 | November Credit Card Expenses PP | Travel |
150.00 |
|
30/11/2015 | November Credit Card Expenses PP | Subsistence | 200.00 | |
30/11/2015 | November Credit Card Expenses PP | Credit Card Control Account | 350.00 | |
30/11/2015 | November Credit Card Expenses AG | Hotel | 60.00 | |
30/11/2015 | November Credit Card Expenses AG | Subscriptions | 5.00 | |
30/11/2015 | November Credit Card Expenses AG | Subscriptions | 10.00 | |
30/11/2015 | November Credit Card Expenses AG | Credit Card Control Account | 75.00 |
Solution
Create master and detail level ClickLink rules to convert journal data from a journal data batch object to journals:
- Create a master ClickLink rule to Convert Journal Data to a Journal. For instance:
Item Value ClickLink Rule Name Convert Journal Data to Journal Source Object JournalBatch__c Source Object Name Field Name Source Object Processed Field Processed__c Source Object Process Field Target Object c2g__codaJournal__c Target Object Name Field Name - Create ClickLink mappings for the rule you created in the previous step. For instance:
Target Record Based On Mapping Type Mapping Literal Source Field Target Field Source Record Source Field Date__c c2g__JournalDate__c Source Record Source Field Description__c c2g__JournalDescription__c Source Record Literal True ffgl__DeriveCurrency__c Source Record Literal True ffgl__DerivePeriod__c Source Record Source Field Name JournalBatch__c - Create a detail level ClickLink rule to convert the journal data to journal lines. For instance:
Item Value ClickLink Rule Name Convert Journal Data to Journal Line Source Object JournalImportData__c Source Object Name Field Name Target Object c2g__codaJournalLineItem__c Target Object Name Field Name - Create ClickLink mappings for the detail level ClickLink rule that you created in the previous step. For instance:
Target Record Type Target Record Based On Mapping Type Mapping Literal Source Field Target Field Analysis Source Record Parent Literal General Ledger Account c2g__LineType__c Analysis Source Record Parent Literal Credit Card Control Account c2g__GeneralLedgerAccount__c Analysis Source Record Parent Source Field NegativeAmount__c c2g_Value__c Default Source Record Source Field Amount__c c2g__Value__c Default Source Record Source Field Description__c c2g__LineDescription__c Default Source Record Literal General Ledger Account c2g__LineType__c Default Source Record Source Field GLA__c c2g__GeneralLedgerAccount__c - On the master-level ClickLink rule, create a ClickLink relationship to link the master level ClickLink rule to the detail level ClickLink relationship:
Description Source Relationship Name Detail ClickLink Rule Source Object Target Object Target Relationship Field Link Master Journal to Detail Journal_Import_Data__r Convert Journal Data to Journal Line JournalImportData__c c2g__codaJournalLineItem__c c2g__Journal__c - Create Visualforce pages to convert the journal batches to journals. For instance, you can use this Visualforce mark-up to process a single journal batch:
<apex:page standardController="JournalBatch__c" extensions="ffirule.IntegrationRuleEngine" action="{!convert}">
<ffirule:IntegrationRule engine="{!engine}"/>
</apex:page>You can use this Visualforce mark-up to process several journal batches on a list view:
<apex:page standardController="JournalBatch__c" extensions="ffirule.IntegrationRuleEngine" action="{!convert}" recordSetVar="records">
<ffirule:IntegrationRule engine="{!engine}"/>
</apex:page> - In the master ClickLink rule Convert Journal Data to Journal, create ClickLink buttons to access the Visualforce pages created in the previous step.
- On the source object Journal Batch, create a Detail Page Button custom button that uses the Visualforce page that you created to process a single batch.
- On the source object Journal Batch, create a List Button custom button that uses the Visualforce page that you created to process several batches on a list view.
To use the solution do one of the following on the Journal Batches tab:
- To process several batches, select the journal batches that you want to process and click Create Journals.
- To process a single batch, click the journal batch number that you want to process and then click Convert to Journal.
The Processed checkbox is selected on the Journal Batches that you processed.