Generate Payable Invoice from Expense Report
Problem
You have expense reports in PSA but need to generate payable invoices in your accounting system for reimbursement.
Solution
Create ClickLink rules using ClickLink to convert PSA expense reports to payable invoices in Accounting:
- Add the following custom fields to the PSA Expense Report object.
- Sent_to_Accounting (checkbox)
- Employee Account (text formula 'PSA User (Employee)')
- Payable Reference (text formula TEXT( pse__First_Expense_Date__c )). This generates a text version of the first expense date. This will be used for the payable invoice reference.
- Add the following custom fields to the Accounting Payable Invoice object:
- Expense Report (Lookup to PSA expense report)
- Add the following custom fields to the Expense object:
- Expense GLA (text formula). The formula should contain CASE(TEXT( pse__Type__c), TypeName, TypeID). Where TypeName, TypeID reflect the data in your system. Your formula might look something like this:
CASE(TEXT( pse__Type__c),'Airfare','6090 - Travel','Lodging (Room and Tax)','6092 - Lodging','Car Rental','6096 - Other Travel','Gasoline','6096 - Other Travel','Taxi','6096 - Other Travel','Subway','6096 - Other Travel','Auto Mileage','6096 - Other Travel','Personal Meals','6091 - Meals','Business Meals','6091 - Meals','Phone','6170 - Telephone','Office Supplies and Services','6080 - Office Expense','IT Equipment and Services','6080 - Office Expense','Postage and Shipping','6080 - Office Expense','General and Admin Expenses','6080 - Office Expense','Employee Relations','6080 - Office Expense','Recruiting','6080 - Office Expense','Miscellaneous','6080 - Office Expense','6096 - Other Travel')
- Expense GLA (text formula). The formula should contain CASE(TEXT( pse__Type__c), TypeName, TypeID). Where TypeName, TypeID reflect the data in your system. Your formula might look something like this:
- Add the following custom fields to the Payable Invoice Expense Line Item object:
- Project (lookup to Project in PSA)
- SetGLAToDefault (checkbox)
- Create a ClickLink rule to convert an expense report to a payable invoice:
Recommended Values for the Create Payable Invoice from Expense Report ClickLink Rule Item Value ClickLink Rule Name Create Payable Invoice from Expense Report Source Object pse__Expense_Report__c Source Object Name Field Name Source Object Processed Field Sent_to_Accounting__c Target Object c2g__codaPurchaseInvoice__c Target Object Name Field Name - Create these ClickLink mappings for the ClickLink rule you created in the previous step:
Recommended Mappings for the Create Payable Invoice from Expense Report ClickLink Rule Target Record Created From Mapping Type Source Field Target Field Source Record Source Field pse__Description__c c2g__InvoiceDescription__c Source Record Source Field pse__Last_Expense_Date__c c2g__InvoiceDate__c Source Record Source Field pse__Project__c Project__c Source Record Source Field Name Expense_Report__c Source Record Source Field Employee_Account__c c2g__Account__c Source Record Source Field Payable_Reference__c c2g__AccountInvoiceNumber__c - Create a ClickLink rule to convert a PSA expense to a payable expense line:
Recommended Values for the Create Payable Expense Line from PSA Expense ClickLink Rule Item Value ClickLink Rule Name Create Payable Expense Line from PSA Expense Source Object pse__Expense__c Source Object Name Field Name Target Object c2g__codaPurchaseInvoiceExpenseLineItem__c Target Object Name Field Name - Create these ClickLink mappings for the ClickLink rule that you created in the previous step:
Recommended Mappings for the Create Payable Expense Line from PSA Expense ClickLink Rule Target Record Created From Mapping Type Mapping Literal Source Field Target Field Source Record Source Field pse__Reimbursement_Amount__c c2g__NetValue__c Source Record Source Field Expense_GLA__c c2g__GeneralLedgerAccount__c Source Record Source Field pse__Description__c c2g__LineDescription__c Source Record Source Field pse__Project__c Project__c Source Record Literal 0 ffap__SetGLAToDefault__c - Create a Visualforce page to convert a single Expense Report to a Payable Invoice. You can use the following Visualforce markup:
<apex:page standardController="pse__Expense_Report__c" extensions="ffirule.IntegrationRuleEngine" action="{!convert}">
<ffirule:IntegrationRule engine="{!engine}"/></apex:page> - Create a Visualforce page to convert payable invoices to expense reports. You can use the following Visualforce markup:
<apex:page standardController="pse__Expense_Report__c" extensions="ffirule.IntegrationRuleEngine" action="{!convert}" recordSetVar="records">
<ffirule:IntegrationRule engine="{!engine}"/></apex:page> - In the Create Payable Invoice from Expense Report ClickLink rule, create ClickLink buttons for the Visualforce pages that you created in the previous step.
- In the Expense Reports object, create custom buttons that reference the Visualforce pages you created in the previous step.
- Add the Create Payable Invoice custom button to the Expense Report page layout
- Add the Create Payable Invoices custom button to the Expense Reports List View search layout.
- Create the following ClickLink relationship:
Recommended Relationship for the Create Payable Invoice from Expense Report ClickLink Rule ClickLink Relationship Name Relationship Name Relationship ClickLink Rule Relationship Target Field Expense Lines to Expense Report pse__Expense_Lines__r Create Payable Expense Line from PSA Expense c2g__PurchaseInvoice__c
To test the ClickLink rule, create an expense report in PSA with approved expenses and click Create Payable Invoice. A payable invoice is created in Accounting with the expenses on the expense report from PSA.