Luis
10/19/2020, 9:03 PMbattk
10/19/2020, 9:05 PMbattk
10/19/2020, 9:06 PMbattk
10/19/2020, 9:08 PMbattk
10/19/2020, 9:08 PMbattk
10/19/2020, 9:10 PMerictgrubaugh
10/19/2020, 9:11 PMlineAccountType == true
as ( "string1" || "string2" || ...)
will always evaulate to true
battk
10/19/2020, 9:14 PM( "string1" || "string2" || ...)
is equal to "string1"
battk
10/19/2020, 9:14 PMbattk
10/19/2020, 9:14 PMerictgrubaugh
10/19/2020, 9:29 PM"string1"
, which will always evaluate to true
battk
10/19/2020, 9:52 PMif ( myVariable == ( "string1" || "string2" || ...))
is equivalent to
if ( myVariable == ( "string1" ))
which is not the same as true
battk
10/19/2020, 9:52 PMalien4u
10/20/2020, 1:53 AMindexOf.
Luis
10/20/2020, 3:12 AMbattk
10/20/2020, 5:48 AMbattk
10/20/2020, 5:49 AMmichoel
10/20/2020, 11:06 AMincludes
Luis
10/20/2020, 2:00 PMLuis
10/20/2020, 2:01 PMbattk
10/20/2020, 2:05 PMLuis
10/20/2020, 2:36 PM/**
* @NApiVersion 2.x
* @NScriptType ClientScript
*/
define(['N/currentRecord', 'N/search'], function(currentRecord, search) {
function fieldChanged(context) {
var currentRecord = context.currentRecord;
var sublistName = context.sublistId;
var sublistFieldId = context.fieldId;
if (sublistName == 'expense' && sublistFieldId == 'account') {
var bsAccountTypes = [
'Bank',
'Fixed Asset',
'Other Asset',
'Other Current Asset',
'Accounts Receivable',
'Accounts Payable',
'Credit Card',
'Other Current Liability',
'Long Term Liability',
'Equity'
];
var lineAccount = currentRecord.getCurrentSublistValue({
sublistId = 'expense',
fieldId = 'account'
});
var lineAccountType = search.lookupFields({
type: search.Type.ACCOUNT,
id: lineAccount,
columns: ['type']
}).type[0].text;
if (bsAccountTypes.indexOf(lineAccountType) != -1) {
currentRecord.setCurrentSublistValue({
sublistId: 'expense',
fieldId: 'department',
value: 203
});
};
};
};
return {
fieldChanged: fieldChanged};
});
battk
10/20/2020, 2:51 PMbattk
10/20/2020, 2:51 PMLuis
10/22/2020, 3:12 AMbattk
10/22/2020, 3:19 AMbattk
10/22/2020, 3:19 AMbattk
10/22/2020, 3:20 AM