Creating an Accounting Journal from an Opportunity

Problem

You want to create a Accounting journal directly from pledge information in a Opportunity. The journal should update the bank account with the accounts received and track the revenue by the donor.

Solution

To use ClickLink to create the information, you need to:

  1. Add the following custom fields to the Opportunity object and the Opportunity Page layout for the pledge and payment information:
    • Bank Account (Lookup)
    • Credit Amount (Formula (currency) with the formula Amount * -1)
    • Credit Payment Reference (Formula(text with the formula Payment_Reference__c))
    • Customer Account (Formula (text with the formula Account.Name))
    • Debit Payment Reference (Formula (text with the formula Payment_Reference__c))
    • Payment Method (Picklist with the values Check, Credit Card and Lockbox)
    • Payment Date
    • Payment Reference (Text(80))
    • Payment Posted to Accounting (checkbox)
    • Amount (Currency 16,2)
  2. Add the following fields to the Journal object:
    • Pledge(Lookup to Opportunity)
    • Payment Method(Text(40))
  3. Create a ClickLink rule to convert the Pledge Information to a Pledge Payment Journal:
    Recommended Values for the Convert Pledge Information to Pledge Payment Journal ClickLink Rule
    ItemValue
    ClickLink Rule NameConvert Pledge Information to Pledge Payment Journal
    Source ObjectOpportunity
    Source Object Name FieldName
    Source Object Process FieldPayment_Posted_to_Accounting__c
    Target Objectc2g__codaJournal__c
    Target Object Name FieldName
  4. Create ClickLink mappings to map the fields from the opportunity to the Journal:
    Recommended Mappings for the Convert Pledge Information to Pledge Payment Journal ClickLink Rule
    Target Record Created FromMapping TypeMapping LiteralSource FieldTarget Field
    Source RecordSource Field Payment_Date__cc2g__JournalDate__c
    Source RecordSource Field Payment_Reference__cc2g__Reference__c
    Source RecordLiteralPAYMENT INFORMATION FOR PLEDGE c2g__JournalDescription__c
    Source RecordSource Field NamePledge__c
    Source RecordSource Field Payment_Method__c Payment_Method__c
  5. Create a ClickLink to convert the Pledge Information to Pledge Payment Journal Line Items:
    Recommended Values for the Convert Pledge to Pledge Payment Journal Line Item ClickLink Rule
    ItemValue
    ClickLink Rule NameConvert Pledge to Pledge Payment Journal Line Item
    Source ObjectOpportunity
    Source Object Name FieldName
    Target Objectc2g__codaJournalLineItem__c
    Target Object Name FieldName
  6. Create ClickLink mappings to map the source fields to the target fields for the rule you created in the previous step:
    Recommended Mappings for the Convert Pledge to Pledge Payment Journal Line Item ClickLink Rule
    Target Record TypeTarget Record Created FromMapping TypeMapping LiteralSource FieldTarget Field
    CreditSource RecordSource Field Credit_Amount__cc2g__Value__c
    CreditSource RecordLiteralAccount - Customer c2g__LineType__c
    CreditSource RecordSource Field Customer_Account__cc2g__Account__c
    CreditSource RecordSource Field Credit_Payment_Reference__c c2g__LineDescription__c
    CreditSource RecordLiteralDonations Received~ c2g__GeneralLedgerAccount__c
    DefaultSource RecordLiteralBank Account c2g__LineType__c
    DefaultSource RecordSource Field Amount c2g__Value__c
    DefaultSource RecordSource Field Bank_Account__c c2g__BankAccount__c
    DefaultSource RecordSource Field Debit_Payment_Reference__cc2g__LineDescription__c
    DefaultSource RecordLiteralBank Account - Checking US~ c2g__GeneralLedgerAccount__c
  7. Create a Visualforce page to convert an Opportunity to a Pledge Journal. You can use the following Visualforce markup:

    <apex:page standardController="Opportunity" extensions="ffirule.IntegrationRuleEngine" action="{!convert}">

    <ffirule:IntegrationRule engine="{!engine}"/></apex:page>
  8. In the Convert Pledge to Pledge Payment Journal ClickLink rule, create a ClickLink button in the to access the Opportunity to Pledge JournalVisualforce page that you created in the previous step.
  9. Create a button in the Opportunities custom buttons and links for the button you created in the previous step.
  10. Create a Visualforce page to convert Opportunity Pledges to Pledge Journals. You can use the following markup:

    <apex:page standardController="Opportunity" extensions="ffirule.IntegrationRuleEngine" action="{!convert}" recordSetVar="records">

    <ffirule:IntegrationRule engine="{!engine}"/></apex:page>
  11. In the Convert Pledge to Pledge Payment Journal ClickLink rule, create a ClickLink button to access the Opportunity Pledges to Pledge Journals Visualforce page you created in the previous step.
  12. Create a button in the Opportunities custom buttons and links for the button you created in the previous step.
  13. Add the ClickLink buttons to the page layout for the Opportunity object.
  14. Create a ClickLink relationship on the Pledge Information to Pledge Payment Journal ClickLink rule that you created in step 3.
    Recommended Relationship for the Convert Pledge Information to Pledge Payment Journal ClickLink Rule
    ClickLink Relationship NameRelationship ClickLink Rule Relationship Target Field
    Journal Lines Items to JournalConvert Pledge to Pledge Payment Journal Line Itemc2g__Journal__c

To test the ClickLink rule open an opportunity and click Create Pledge Journal. A journal should be created with at least one journal line item depending on your accounting data.