Spreading Utility Bill Costs Between Departments
This case study uses Accounting and ClickLink to carry out a conversion on a utility bill. For information about creating ClickLink rules, see Using the Application. You can create custom fields with different names to those shown in this case study, however you must ensure that you change the name in all locations that reference it.
Problem
Your company receives an invoice and you want to work out the cost generated by each department based on the head count of your organization.
Solution
Create ClickLink rules to work out the cost from each department. To do this:
- Create a new custom setting with a number field for each department. For instance, you could call the custom setting Headcount by Dept and add fields such as G & A, Operations, Sales and Support.
- Edit the custom setting and enter the number of employees for each department field that you added in the previous step. The numbers you enter are used to generate the cost allocation for each department.
- Add a formula number custom field on the Payable Invoice object for each field that you added to the custom setting you created in step 1 with the following formula:
Round(c2g__InvoiceTotal__c * ($setup.[YourCustomSetting]__c.[[YourCustomFieldThisField]__c / ($setup.[YourCustomSetting]__c.][YourCustomField]__c + $setup.[YourCustomSetting]__c.[YourCustomField]__c +$setup.[YourCustomSetting]__c.[YourCustomField]__c +$setup.[YourCustomSetting]__c.[YourCustomField]__c)),2)
Replace [YourCustomFieldThisField] with the field for the department that you are creating the formula custom number field for. Replace .[YourCustomSetting] with the custom setting you created in step 1 and replace [YourCustomField] with the custom field that you created in step 2.
For instance, if you are creating a formula number custom field for the GA department, the formula might look something like this:
Round(c2g__InvoiceTotal__c * ($Setup.HeadcountByDept__c.GA__c/($Setup.HeadcountByDept__c.Sales__c+$Setup.HeadcountByDept__c.GA__c + $Setup.HeadcountByDept__c.Support__c +$Setup.Headcount.Operations__c )),2)
- In the Payable Invoice object, create a custom checkbox field called Allocated.
- In the Payable Invoice object, create the following custom fields with the text formula c2g__Account__r.c2g__CODADefaultExpenseAccount__r.Name:
- Allocation Expense Support GLA
- Allocation Expense Operations GLA
- Allocation Expense Sales GLA
- Allocation Expense G&A GLA
- Allocation Expense GLA
- In the Payable Invoice object, create a formula (currency) field called Allocation_Reversing_Amount with this formula: c2g__InvoiceTotal__c * -1.
- Add a Departmental Allocation section to the Payable Invoice page layout with the fields that you set up in the previous steps.
- Create a new ClickLink rule to Allocate Departmental Expenses.
- Click the ClickLink Rules tab.
- Click New.
- Complete the fields described in Rule Fields
- Create these ClickLink mappings for the ClickLink rule that you created in the previous step:
Recommended Mappings for the Allocate Departmental Expenses ClickLink Rule Target Record Type Target Record Created From Mapping Type Mapping Literal Source Field Target Field Default Source Record Source Field Name c2g__Reference__c Default Source Record Literal Departmental Headcount Allocation c2g__JournalDescription__c Default Source Record Source Field c2g__InvoiceDate__c c2g__JournalDate__c Default Source Record Source Field Name Payable_Invoice__c To create a ClickLink mapping:
- Click New ClickLink Mapping.
- Complete the fields described in Mapping Fields.
- Click Save.
- Create this ClickLink rule to Map payable invoices to Allocation Journal Lines:
Recommended Values for the Map Payable Invoice to Journal Lines ClickLink Rule Item Value ClickLink Rule Name Map Payable invoice to Journal Lines Source Object c2g__codaPurchaseInvoice__c Target Object c2g__codaJournalLineItem__c Source Object Name Field Name Target Object Name Field Name - Create ClickLink mappings for the ClickLink rule that you created in the previous step. For instance, if you are allocating the expense using the departments in step 1, you might include the following mappings:
Recommended Mappings for the Map Payable Invoice to Journal Lines ClickLink Rule Target Record Type Target Record Created From Mapping Type Mapping Literal Source Field Target Field Default Source Record Source Field Allocation_Expense_GLA__c c2g__GeneralLedgerAccount__c Default Source Record Literal Allocation Rule - Reversing entry for unallocated expense c2g__LineDescription__c Default Source Record Source Field Allocation_Reversing_Amount__c c2g__Value__c Default Source Record Literal General Ledger Account c2g__LineType__c Default Source Record Source Field Allocation_for_G_A__c c2g__Value__c G&A Source Record Source Field Allocation_Expense_G_A_GLA__c c2g__GeneralLedgerAccount__c G&A Source Record Literal Allocation for G & A Dept c2g__LineDescription__c G&A Source Record Literal General Ledger Account c2g__LineType__c G&A Source Record Literal G & A c2g__Dimension3__c Operations Source Record Literal General Ledger Account c2g__LineType__c Operations Source Record Source Field Allocation_for_Operations__c c2g__Value__c Operations Source Record Source Field Allocation_Expense_Operations_GLA__c c2g__GeneralLedgerAccount__c Operations Source Record Literal Allocation for Operations Dept c2g__LineDescription__c Operations Source Record Literal Operations c2g__Dimension3__c Sales Source Record Source Field Allocation_Expense_Sales_GLA__c c2g__GeneralLedgerAccount__c Sales Source Record Source Field Allocation_for_Sales__c c2g__Value__c Sales Source Record Literal Allocation for Sales Dept c2g__LineDescription__c Sales Source Record Literal General Ledger Account c2g__LineType__c Sales Source Record Literal Sales c2g__Dimension3__c Support Source Record Source Field Allocation_for_Support__c c2g__Value__c Support Source Record Source Field Allocation_Expense_Support_GLA__c c2g__GeneralLedgerAccount__c Support Source Record Literal Allocation for Support Dept c2g__LineDescription__c Support Source Record Literal General Ledger Account c2g__LineType__c Support Source Record Literal Support c2g__Dimension3__c - Create the following ClickLink Relationship:
Recommended Relationship for the Map Payable Invoice to Allocation Journal Lines ClickLink Rule ClickLink Relationship Name Relationship ClickLink Rule Relationship Source Object Relationship Target Object Relationship Target Field Journal Lines Items to Journal Map Payable Invoice to Allocation Journal Lines c2g__codaPurchaseInvoice__c c2g__codaJournalLineItem__c c2g__Journal__c - Create Visualforce pages to display the rule information on.
- Create ClickLink buttons to access the Visualforce pages you created in the previous step.
- Add Custom buttons in the Payable Invoice object for the Visualforce pages you created in the previous step.
- Modify Page layouts and list views to include the buttons created in the previous step.
- Add a Departmental Allocation section to the Payable Invoices page layout with the fields you created from step 1.
To test the ClickLink rule, open a payable invoice and select the custom button you added to the page layout.