Is there a way to map the Account Type field (on a...
# suitescript
c
Is there a way to map the Account Type field (on an Account) field text to the field value? On the Account record UI, the Account Type field has the following value: Other Current Asset but the Chrome record browser plugin shows the value as OthCurrAsset. I am importing Account fields from a database and creating the Account records via NS. The database has Other Current Asset but it doesn't know about the internal value record.setText('Other Current Asset') did not help so I assume I have to record.setValue('OthCurrAsset') but I obviously need a map.
Here's a mapping for anyone else that wants is
Copy code
const ACCOUNT_TYPE_MAP = {
    'Other Current Asset'     : 'OthCurrAsset',
    'Other Current Liability' : 'OthCurrLiab',
    'Expense'                 : 'Expense',
    'Accounts Payable'        : 'AcctPay',
    'Accounts Receivable'     : 'AcctRec',
    'Cost of Goods Sold'      : 'COGS',
    'Long Term Liability'     : 'LongTermLiab',
    'Fixed Asset'             : 'FixedAsset',
    'Other Expense'           : 'OthExpense',
    'Deferred Revenue'        : 'DeferRevenue',
    'Deferred Expense'        : 'DeferExpense',
    'Equity'                  : 'Equity',
    'Income'                  : 'Income',
    'Other Income'            : 'OthIncome',
    'Bank'                    : 'Bank',
    'Other Asset'             : 'OthAsset'
};
1