How can I get Avalara to calculate tax on an invoi...
# ask-stanley-ai
p
How can I get Avalara to calculate tax on an invoice created by script with a custom address?
c
AI generated answer (using internal Slack threads):
To get Avalara to calculate tax on an invoice created by script with a custom address, you would need to ensure that the custom address is set as the shipping address on the invoice record. Avalara calculates tax based on the shipping address of the transaction. Here's a general idea of how you might do this in SuiteScript:
Copy code
javascript
var invoiceRecord = record.create({
    type: record.Type.INVOICE,
    // other properties...
});

// Set the shipping address
invoiceRecord.setValue({
    fieldId: 'shippingaddress',
    value: yourCustomAddress // this should be an address object or similar
});

// Save the record
var invoiceId = invoiceRecord.save({
    enableSourcing: true,
    ignoreMandatoryFields: true
});
Please note that this is a simplified example and you may need to adjust it to fit your specific needs. Also, make sure that the custom address is valid and can be recognized by Avalara for tax calculation. ****** Disclaimer: This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes. ******
Slack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.880188048
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.862915158
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.856018126
Please provide your feedback on this answer.