Setup
Avalara AvaTax is a cloud based solution automating transaction tax calculations and the tax filing process. Avalara provides real-time tax calculation using tax content from more than 12,000 US taxing jurisdictions and over 200 countries, insuring your transaction tax is calculated based on the most current tax rules.
The goal of the integration with AvaTax is to manage the tax calculation for the products a user can add in a quote. The user thus has the ability to navigate in CPQ Catalog to select and add products in the quote. Then, the user can make calls to AvaTax from the Quote runtime interface or by using
pre-configured triggers. By providing mandatory settings as input of these calls, such as AvaTax URL and credentials, tax codes, origin and destination addresses, etc., the user will get as a result the tax amount calculated for each product of his quote.
Avalara subscription and installation
The first step consists in getting a subscription allowing you to use Avalara tax management solution with CPQ. You will have to follow the AvaTax account activation process on www.avalara.com.
The Avalara connector is natively integrated in Smart CPQ, meaning that you don’t have to download or install anything. You will just have to follow the steps below explaining how to setup the connector.
Service setup in CPQ
Once your subscription valid, you have to fulfill the section of the cameleon.properties file dedicated to Avalara with the service URL and credentials (user / password), and the path to the AvalaraMapping.xml file on the CPQ server.
If activated, you can fill in these parameters by leveraging the CPQ Designer Manage File menu:
Product tax code
In order to have the right granularity for the tax computation of all your products, you will have to associate a tax code to every eligible product in the Catalog. The simplest way consists in defining a specific Business Property in the Catalog and associating it with every product concerned.
To see a listing of all available AvaTax System tax codes, please click the following URL: http://taxcode.avatax.avalara.com
Quote columns
In the quote spreadsheet, two columns are required for the call to AvaTax: one to store the tax amount and one to store the product tax code from the Catalog.
They have to be defined as follows in the Quote Designer: In the Quote Designer:
- Go to Spreadsheet Builder > Grid > Columns.
- Define the two following columns:
- Map the Avalara Tax Code on the corresponding attributes of the Catalog (using Xpath for instance). This column might be hidden if required.
- Define the Avalara Tax column as Computed/Internal.
- Map the Avalara Tax Code on the corresponding attributes of the Catalog (using Xpath for instance). This column might be hidden if required.
- Save the model and clear the model cache.
Quote actions
CALL TO AVATAX
Calling AvaTax from the Quote to calculate taxes can be done by leveraging triggers or on-demand actions. The corresponding actions have to be setup in the Quote Designer and could apply at the Quote and/or at the Quote line level.
In the Quote Designer:
- Go to Spreadsheet Spreadsheet Builder > Actions.
- For an action at the line level, go in the onDemand Line Actions section and create a new action with the following characteristics:
- Name: Calculate tax
- Type: Predefined > AvalaraTax
- Activation Conditions: Single on CT7 lines
- Help Message: Calculate Tax
- Read-only mode: Yes
- Access rights: open
By opening the line action box on a specific quote line, and by clicking on “Calculate Tax”, the call to AvaTax is made for the product on the quote line and the resulting tax amount, if any, is displayed in the Avalara Tax column.
- For an action at the grid level, go in the onDemand Grid Actions section and create a new action with the following characteristics:
- Name: CalculateAllTaxes
- Type: Predefined > AvalaraTaxAll
- Title: Calculate All Taxes
- Help message: Calculate taxes for all the products
- Read-only mode: Yes
- Access Rights: open
By clicking on the “Calculate All Taxes” button on the Quote interface, a call to AvaTax is
made for all the products contained in the quote and the resulting tax amount, if any, is displayed in the Avalara Tax column.
- Name: CalculateAllTaxes
- For a trigger in the quote, go in the Automated Action section and create a new trigger with the following characteristics:
- Triggers: AvalaraTaxTrigger
- Name: AvalaraTaxCalculation
- Type: AvalaraTax
You can then trigger this action on a change of price or quantity on a product line for instance and make a new call to AvaTax every time to get the tax computed again.
Note: In case where your quote contains a large number of products, computing all the taxes with an on demand grid action or computing the quote again via a trigger could be time consuming.
- Triggers: AvalaraTaxTrigger
ADDRESS VALIDATION
CPQ provides, as a complement of the Avalara Connector, an action based on a Java class allowing the end-user to validate the addresses contained in the mapping file. This action can be associated with a button to integrate where relevant in the quote model.
Once defined, a click on the button will request the Avalara Address Validation service for all the addresses in the AvalaraMapping.xml file and return a message.
AVATAX AVAILABILITY
CPQ provides, as a complement of the Avalara Connector, an action based on a Java class allowing the end-user to test the connection with AvaTax. This action can be associated with a button to integrate where relevant in the quote model.
Once defined, a click on the button will request Avalara and return a message giving the status of the connection.
CPQ-to-AvaTax Mapping
When making calls to AvaTax at runtime, CPQ must provide the required input parameters for the request to be successful. These input parameters are retrieved by CPQ - possibly from different sources such as the Quote, a CRM, etc. – and passed in the request for tax calculation.
MAPPING FILE
The definition of each parameter of the request is done in a dedicated file on the CPQ
server: AvalaraMapping.xml. If activated, you have the ability to view the file by leveraging the CPQ Designer Manage File menu.
Here is an example of a standard mapping file:
MAPPING STRUCTURE
Structure of the AvalaraMapping.xml file:
The file is divided in 5 sections:
- The global
<AvalaraMapping>tag encapsulates all the file structure The<Settings>section contains configuration parameters for CPQ - The
<Global>section contains parameters valid for all quotes of the specific instance of Avalara associated with CPQ - The
<Line>section contains parameters specific to each product, and thus to retrieved from eachquote line
- The
<Addresses>section is used to define the origin and destination addresses required for the tax calculation. Each address is encapsulated in an<Address>tag.
Each section contains a set of <fieldMapping>, each one defining the mapping between a parameter required by AvaTax and a CPQ element. Each <fieldMapping> is composed of:
- A
fieldattribute corresponding to the name of the AvaTax parameter - A
cpqTypecorresponding to the type of CPQ element to map on the AvaTax field. It could be:Constant: takecpqExpras isCartColumn: find the value in the column identified bycpqExprCartTotal: find the value in the total cell identified bycpqExprCartField: find the value in cart fieldsCartAttribute: find the value in cart attributes
- A
cpqExprdefining the expression or the reference to the CPQ element providing the value to map on the AvaTax field - Optionally a
defaultValue, if nocpqExprcan be provided
MAPPING CONTENT
Definition of the AvaTax fields in the AvalaraMapping.xml file:
- Settings
LineTypes: types of CPQ quote lines on which the taxes have to be calculatedLogMessages: Activate or not the traces of the requests between CPQ and Avalara
- Global
CustomerCode: ID to flag the customer as exemptedExemptionNo: number used for product exempted of taxDocCode: invoice number or sales order of the transaction (quote ID)CompanyCode: ID of the company in AvalaraDocType: The DocType field drives whether or not the transaction is recorded to the AvaTax admin console and the type of transaction being recorded
- Line
Amount: total price of the product in the quoteResultColumn: quote column where to store the result of the requestQuantity: quantity of the product in the quoteProductName: product descriptionTaxCode: code used to trigger taxability rules specific to the productItemCode: item identifier or SKUDestinationAddressCode: code of the destination address in the addresses listOriginAddressCode: code of the origin address in the addresses list
- Address
AddressCode: code of the address necessary to associate an address to the destination/origin address in the “Line” sectionLine1: first part of the addressLine2: second part of the addressLine3: third part of the addressCity: address cityRegion: address regionPostalCode: address postal codeCountry: address country
