What is the internal ID for the tax code record? I...
# ask-stanley-ai
j
What is the internal ID for the tax code record? I want the actual record internal ID for script/searching purposes, not the field ID.
c
AI generated answer (using internal Slack threads):
The internal ID for the tax code record can be obtained by using the
getLineItemValue
method on the sales order record. In the provided code sample, the tax code internal ID is being retrieved with the following line of code:
var tax_code = so.getLineItemValue('item', 'taxcode', i);
. However, it's important to note that the internal ID returned by this method is the numeric ID of the tax code, not the script ID. If you need the script ID, you would need to perform a search on the tax code record using the numeric ID as a filter. Here is a sample code snippet that demonstrates how to perform such a search:
Copy code
javascript
var taxCodeSearch = search.create({
   type: 'salestaxitem',
   filters: [
      ['internalid', 'anyof', tax_code]
   ],
   columns: ['scriptid']
});

var resultSet = taxCodeSearch.run();
var result = resultSet.getRange({start: 0, end: 1});

if(result.length > 0) {
   var scriptId = result[0].getValue({name: 'scriptid'});
   console.log('Script ID: ' + scriptId);
}
In this code,
tax_code
is the numeric internal ID you obtained from the
getLineItemValue
method. The search returns the script ID of the tax code record with that internal ID. ****** 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.83112973
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.82973665
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829447627
Please provide your feedback on this answer.