Ron
06/19/2025, 4:01 PMCeligo AI
06/19/2025, 4:01 PMAI generated answer (using internal Slack threads):To add a Tax ID to a Sales Order using SuiteScript, you would typically need to update the Tax ID on the customer record first, as the Tax ID is usually associated with the customer, not the transaction. Once the Tax ID is updated on the customer record, it should automatically populate on new transactions created for that customer. However, for existing transactions where the Tax ID is blank, you can use SuiteScript to update this field. You can use the
record.submitFields
method to update the Tax ID on the Sales Order. Here is a sample code snippet:
javascript
var record = require('N/record');
function updateTaxID(salesOrderId, taxId) {
record.submitFields({
type: record.Type.SALES_ORDER,
id: salesOrderId,
values: {
'custbody_tax_id': taxId
},
});
}
In this code, replace 'custbody_tax_id'
with the actual field ID of the Tax ID on your Sales Order record. Also, ensure that the Tax ID field is not locked or restricted from script or workflow updates.
For detecting if an item selected on a line in a sales order/invoice/credit memo/etc needs a tax group or a tax code, you can use the record.getLineItemValue
method to get the value of the 'taxcode' field for the item. If the 'taxcode' field is empty, then it might require a tax group or a tax code.
To update the tax code on a sales order when an item is added, you can use the postSourcing
entry point in a client script. This entry point is triggered when a sublist field sourcing has completed.
******
Disclaimer:
This response was generated by an artificial intelligence assistant based on previous conversations from multiple Slack channels, and may contain inaccuracies or mistakes.
******Celigo AI
06/19/2025, 4:01 PMSlack thread 1: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82509172
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.821547091
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.817992151
Celigo AI
06/19/2025, 4:01 PM