Mapping
Select SFX app, click on the “Xero Custom Object Mapping”
Create a new record with the below parameters
Invoice can be generated from a single custom object or from an object with a child object. Child object is where your line items are stored.
To generate invoice from custom object, the objects should have the below mandatory fields
- Name
- Invoice/Bill Object
- SFX Invoice Lookup field (In the RDSFX Invoice object, create a lookup field to your custom object which you want to use for Invoicing)
- Invoice Account Lookup Field
- Invoice Contact Lookup Field (ensure your contact has a email id, which is mandatory to create and map invoice in Xero)
- Line Item Qty field
- Line Item Unit Price field
Ensure the above fields are existing in the respective custom object(s) and the API name used in the “Xero Custom Object Mapping” layout.
To create Invoice from two custom objects, a master and a child object(viz, line items object)
- If child object is used, please be sure to map the relevant API names from the child object.
- A typical child object will contain fields such as Product description, price, quantity, discount, account code and tax code.
Refer the screen shot below
A Mapping id is generated and displayed on the layout for use of Invoice creation
Creating “New Invoice” button from Custom Object
Go to the custom object nominated as your Invoice Master from the setup
Select the object
Go to <Buttons, Links and Actions>
Select <New Button or Link>
Give a label name <New Invoice>
Select the option <Detail page button>
In the formula section, enter the below function with parameters
/apex/RDSFX__InvoicePage?mappingid=<mappingID>&recordid={!<CustomObject.Id}
Ex: /apex/RDSFX__InvoicePage?mappingid=a0S0o00001lhu7M&recordid={!Energy_Audit__c.Id}
Ensure the characters <, >, and any space in-between the formula is removed
For the mapping id refer Mapping section
NOTE: Ensure there is no extra spaces in-between the formula
Remember to add the <New Invoice button> on the page layout.