When setting an item discount why is it making me ...
# suitescript
g
When setting an item discount why is it making me set an Account and Rate. Shouldnt the itemid be enough?
Copy code
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()
(setting the account does not work here either, tried with setting the value and both the name and id as well)
b
your code works for me
follow the same rules as the ui
your discount item needs either an account
or the non posting checkbox set