Order and Inventory Management Apex API Developer Reference

scmc.AvalaraTaxCalculationService

global with sharing class AvalaraTaxCalculationService

This service enables you to use Avalara AvaTax to perform the following actions on Order and Inventory Management documents:

  • Calculate tax
  • Post tax
  • Commit tax
  • Cancel tax
Note: To use this service, external tax calculation using Avalara must be enabled in Foundations and your org must be properly configured. For more information, see the Certinia Help.

Methods

AvalaraTaxCalculationService

global AvalaraTaxCalculationService()

Constructor for the service.

calculateTaxForPurchaseOrder

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForPurchaseOrder(Set<Id> purchaseOrderIds)

Calculates tax for the specified purchase orders.

Input Parameters

Name Type Description
purchaseOrderIds Set<Id> IDs of the purchase orders for which tax is to be calculated.

Return Value

Map that contains the ID of the purchase order and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForApVoucher

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForApVoucher(Set<Id> apVoucherIds)

Calculates tax for the specified AP vouchers.

Input Parameters

Name Type Description
apVoucherIds Set<Id> IDs of the AP vouchers for which tax is to be calculated.

Exceptions Thrown

Value Description
SCMC.APVoucherException Thrown when the AP voucher is in a status where tax cannot be calculated.

Return Value

Map that contains the ID of the AP voucher and a result that indicates whether the action was successful and provides a user-friendly success or error message.

postTaxForApVoucher

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> postTaxForApVoucher(Set<Id> apVoucherIds)

Posts tax in Avalara for the specified AP vouchers.
Note: You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.

Input Parameters

Name Type Description
apVoucherIds Set<Id> IDs of the AP vouchers for which the tax is to be posted.

Exceptions Thrown

Value Description
SCMC.APVoucherException Thrown when the AP voucher is in a status where tax cannot be posted.

Return Value

Map that contains the ID of the AP voucher and a result that indicates whether the action was successful and provides a user-friendly success or error message.

commitTaxForApVoucher

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> commitTaxForApVoucher(Set<Id> apVoucherIds)

Commits tax in Avalara for the specified AP vouchers.
Notes:

  • You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.
  • If the Posting Tax to Avalara Optional checkbox is selected on the Tax Calculation Settings page, this action first posts the tax and immediately commits it in Avalara.

Input Parameters

Name Type Description
apVoucherIds Set<Id> IDs of the AP vouchers for which the tax is to be committed.

Exceptions Thrown

Value Description
SCMC.APVoucherException Thrown when the AP voucher is in a status where tax cannot be committed.

Return Value

Map that contains the ID of the AP voucher and a result that indicates whether the action was successful and provides a user-friendly success or error message.

cancelTaxForApVoucher

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> cancelTaxForApVoucher(Set<Id> apVoucherIds)

Cancels tax in Avalara for the specified AP vouchers.

Input Parameters

Name Type Description
apVoucherIds Set<Id> IDs of the AP vouchers for which the tax is to be canceled.

Exceptions Thrown

Value Description
SCMC.APVoucherException Thrown when the AP voucher is in a status where tax cannot be canceled.

Return Value

Map that contains the ID of the AP voucher and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForApVoucherCredit

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForApVoucherCredit(Set<Id> apVoucherCreditIds)

Calculates tax for the specified AP voucher credits.

Input Parameters

Name Type Description
apVoucherCreditIds Set<Id> IDs of the AP voucher credits for which tax is to be calculated.

Return Value

Map that contains the ID of the AP voucher credit and a result that indicates whether the action was successful and provides a user-friendly success or error message.

postTaxForApVoucherCredit

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> postTaxForApVoucherCredit(Set<Id> apVoucherCreditIds)

Posts tax in Avalara for the specified AP voucher credits.
Note: You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.

Input Parameters

Name Type Description
apVoucherCreditIds Set<Id> IDs of the AP voucher credits for which the tax is to be posted.

Return Value

Map that contains the ID of the AP voucher credit and a result that indicates whether the action was successful and provides a user-friendly success or error message.

commitTaxForApVoucherCredit

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> commitTaxForApVoucherCredit(Set<Id> apVoucherCreditIds)

Commits tax in Avalara for the specified AP voucher credits.
Notes:

  • You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.
  • If the Posting Tax to Avalara Optional checkbox is selected on the Tax Calculation Settings page, this action first posts the tax and immediately commits it in Avalara.

Input Parameters

Name Type Description
apVoucherCreditIds Set<Id> IDs of the AP voucher credits for which the tax is to be committed.

Return Value

Map that contains the ID of the AP voucher credit and a result that indicates whether the action was successful and provides a user-friendly success or error message.

cancelTaxForApVoucherCredit

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> cancelTaxForApVoucherCredit(Set<Id> apVoucherCreditIds)

Cancels tax in Avalara for the specified AP voucher credits.

Input Parameters

Name Type Description
apVoucherCreditIds Set<Id> IDs of the AP voucher credits for which the tax is to be canceled.

Return Value

Map that contains the ID of the AP voucher credit and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForCustomerQuotation

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForCustomerQuotation(Set<Id> customerQuotationIds)

Calculates tax for the specified customer quotations.

Input Parameters

Name Type Description
customerQuotationIds Set<Id> IDs of the customer quotations for which tax is to be calculated.

Return Value

Map that contains the ID of the customer quotation and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForSalesOrder

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForSalesOrder(Set<Id> salesOrderIds)

Calculates tax for the specified sales orders.

Input Parameters

Name Type Description
salesOrderIds Set<Id> IDs of the sales orders for which tax is to be calculated.

Return Value

Map that contains the ID of the sales order and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForInvoice(Set<Id> invoiceIds)

Calculates tax for the specified invoices.

Input Parameters

Name Type Description
invoiceIds Set<Id> IDs of the invoices for which tax is to be calculated.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already committed or canceled for the invoice.

Return Value

Map that contains the ID of the invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

postTaxForInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> postTaxForInvoice(Set<Id> invoiceIds)

Posts tax in Avalara for the specified invoices.
Note: You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.

Input Parameters

Name Type Description
invoiceIds Set<Id> IDs of the invoices for which the tax is to be posted.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already posted, committed, or canceled for the invoice.

Return Value

Map that contains the ID of the invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

commitTaxForInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> commitTaxForInvoice(Set<Id> invoiceIds)

Commits tax in Avalara for the specified invoices.
Notes:

  • You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.
  • If the Posting Tax to Avalara Optional checkbox is selected on the Tax Calculation Settings page, this action first posts the tax and immediately commits it in Avalara.

Input Parameters

Name Type Description
invoiceIds Set<Id> IDs of the invoices for which the tax is to be committed.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already committed or canceled for the invoice.

Return Value

Map that contains the ID of the invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

cancelTaxForInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> cancelTaxForInvoice(Set<Id> invoiceIds)

Cancels tax in Avalara for the specified invoices.

Input Parameters

Name Type Description
invoiceIds Set<Id> IDs of the invoices for which the tax is to be canceled.

Return Value

Map that contains the ID of the invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

calculateTaxForCreditInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> calculateTaxForCreditInvoice(Set<Id> creditInvoiceIds)

Calculates tax for the specified credit invoices.

Input Parameters

Name Type Description
creditInvoiceIds Set<Id> IDs of the credit invoices for which tax is to be calculated.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already committed or canceled for the credit invoice.

Return Value

Map that contains the ID of the credit invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

postTaxForCreditInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> postTaxForCreditInvoice(Set<Id> creditInvoiceIds)

Posts tax in Avalara for the specified credit invoices.
Note: You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.

Input Parameters

Name Type Description
creditInvoiceIds Set<Id> IDs of the credit invoices for which the tax is to be posted.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already posted, committed, or canceled for the credit invoice.

Return Value

Map that contains the ID of the credit invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

commitTaxForCreditInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> commitTaxForCreditInvoice(Set<Id> creditInvoiceIds)

Commits tax in Avalara for the specified credit invoices.
Notes:

  • You can only perform this action if the Disable Commit checkbox is deselected on the Tax Calculation Settings page.
  • If the Posting Tax to Avalara Optional checkbox is selected on the Tax Calculation Settings page, this action first posts the tax and immediately commits it in Avalara.

Input Parameters

Name Type Description
creditInvoiceIds Set<Id> IDs of the invoices for which the tax is to be committed.

Exceptions Thrown

Value Description
SCMC.SCMException Thrown when tax was already committed or canceled for the credit invoice.

Return Value

Map that contains the ID of the credit invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

cancelTaxForCreditInvoice

global static Map<Id, scmc.AvalaraTaxCalculationService.Result> cancelTaxForCreditInvoice(Set<Id> creditInvoiceIds)

Cancels tax in Avalara for the specified credit invoices.

Input Parameters

Name Type Description
creditInvoiceIds Set<Id> IDs of the credit invoices for which the tax is to be canceled.

Return Value

Map that contains the ID of the credit invoice and a result that indicates whether the action was successful and provides a user-friendly success or error message.

scmc.AvalaraTaxCalculationService.Result

global inherited sharing class Result

Result that indicates whether an scmc.AvalaraTaxCalculationService action was successful and contains a user-friendly success or error message.

Properties

Name Type Description
success Boolean Set to true when the action was successful.
Set to false when the action was unsuccessful.
message String Contains a success message when the action was successful.
Contains an error message when the action was unsuccessful.
© Copyright 2009–2023 Certinia Inc. All rights reserved. Various trademarks held by their respective owners.