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:

Example Expense Lines
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
Note:

This scenario assumes that data has been imported previously using the method described in Scenario D Batch Import.

Solution

Create master and detail level ClickLink rules to convert journal data from a journal data batch object to journals:

  1. Create a master ClickLink rule to Convert Journal Data to a Journal. For instance:
    Recommended Values for the Convert Journal Data to Journal ClickLink Rule
    ItemValue
    ClickLink Rule NameConvert Journal Data to Journal
    Source ObjectJournalBatch__c
    Source Object Name FieldName
    Source Object Processed FieldProcessed__c
    Source Object Process Field 
    Target Objectc2g__codaJournal__c
    Target Object Name FieldName
  2. Create ClickLink mappings for the rule you created in the previous step. For instance:
    Recommended Mappings for the Convert Journal Data to Journal ClickLink Rule
    Target Record Based OnMapping TypeMapping LiteralSource FieldTarget Field
    Source RecordSource Field  Date__c c2g__JournalDate__c
    Source RecordSource Field Description__c c2g__JournalDescription__c
    Source RecordLiteralTrue ffgl__DeriveCurrency__c
    Source RecordLiteralTrue ffgl__DerivePeriod__c
    Source RecordSource Field NameJournalBatch__c
  3. Create a detail level ClickLink rule to convert the journal data to journal lines. For instance:
    Recommended Values for the Convert Journal Data to Journal Line ClickLink Rule
    ItemValue
    ClickLink Rule NameConvert Journal Data to Journal Line
    Source ObjectJournalImportData__c
    Source Object Name FieldName
    Target Objectc2g__codaJournalLineItem__c
    Target Object Name FieldName
  4. Create ClickLink mappings for the detail level ClickLink rule that you created in the previous step. For instance:
    Recommended Mappings for the Convert Journal Data to Journal Line ClickLink Rule
    Target Record TypeTarget Record Based OnMapping TypeMapping LiteralSource FieldTarget Field
    AnalysisSource Record ParentLiteralGeneral Ledger Account c2g__LineType__c
    AnalysisSource Record ParentLiteralCredit Card Control Account c2g__GeneralLedgerAccount__c
    AnalysisSource Record ParentSource Field NegativeAmount__cc2g_Value__c
    DefaultSource RecordSource Field Amount__cc2g__Value__c
    DefaultSource RecordSource Field Description__cc2g__LineDescription__c
    DefaultSource RecordLiteralGeneral Ledger Account c2g__LineType__c
    DefaultSource RecordSource Field GLA__cc2g__GeneralLedgerAccount__c
    Note:

    This table includes Analysis target lines. These record the double entry for the journal.

  5. On the master-level ClickLink rule, create a ClickLink relationship to link the master level ClickLink rule to the detail level ClickLink relationship:
    Recommended Relationship for the Convert Journal Data to Journal ClickLink Rule
    DescriptionSource Relationship NameDetail ClickLink RuleSource ObjectTarget ObjectTarget Relationship Field
    Link Master Journal to DetailJournal_Import_Data__rConvert Journal Data to Journal LineJournalImportData__cc2g__codaJournalLineItem__cc2g__Journal__c
  6. 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>

  7. In the master ClickLink rule Convert Journal Data to Journal, create ClickLink buttons to access the Visualforce pages created in the previous step.
  8. 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.
  9. 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.
Note:

If you created buttons with different names, select the buttons that you created.

The Processed checkbox is selected on the Journal Batches that you processed.