Account change for Discount item type
# ask-stanley-ai
a
Account change for Discount item type
c
AI generated answer (using internal Slack threads):
Based on the conversations, it appears that once a Discount item has been used in a posting transaction, you cannot change the account associated with it. This is likely a measure to maintain the integrity of the financial data. When creating a discount item, you are required to set an Account and Rate. This is because the discount item needs to be associated with an account for financial tracking purposes. The rate is required to determine the amount of the discount. If you do not want the discount item to post to an account, you can set the non-posting checkbox. Here is a sample code snippet for creating a discount item:
Copy code
javascript
var discountItem = record.create({
  type: record.Type.DISCOUNT_ITEM,
  isDynamic: true
})
log.debug('created discount item, need to set details')
discountItem.setText({ fieldId: 'account',text:'1200 Accounts Receivable' })
discountItem.setValue({ fieldId: 'itemid',value: '1801'})// value: 'Home Depot Discount' })
discountItem.setText({ fieldId: 'rate', text: '-2.44%' })
discountItem.save()
In this code, the 'account' field is set to '1200 Accounts Receivable', the 'itemid' is set to '1801', and the 'rate' is set to '-2.44%'. If you are having trouble setting the account, make sure you are using the correct account ID or name. ****** 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.848144531
Slack thread 2: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.829284668
Slack thread 3: here (available only if the original thread was posted in the last 90 days)
Similarity score: 0.823364139
Please provide your feedback on this answer.