jen
10/26/2023, 12:46 AMrecord.load()
or currentRecord.get()
, is there way to tell that it’s a type of transaction
without checking all possible transaction types e.g. salesorder
, estimate
etc?erictgrubaugh
10/26/2023, 1:28 AMconst isTransaction = (type) => {
const transactionTypes = ['salesorder', ...];
return transactionTypes.includes(type);
}
tdietrich
10/26/2023, 1:43 AMSELECT BUILTIN.DF(Type) FROM Transaction WHERE ID = 4939031
burkybang
10/26/2023, 1:13 PMburkybang
10/26/2023, 2:15 PM/**
* @type {record.Record}
* @return {string}
*/
const isTransactionType = rec => !!rec.getField({fieldId: 'transactionnumber'})?.id;
The second one, getBaseRecordType, gets a portion of the record's URL. It's definitely on the creative side and won't work for all types of records, but it at least works for items, transactions, cases, and custom record types.
/**
* @type {record.Record}
* @return {string}
*/
const getBaseRecordType = rec =>
url.resolveRecord({
recordType: rec.type,
recordId: rec.id,
}).split('/')[3].replace(/s$/, '');
Mike Robbins
10/26/2023, 2:40 PMburkybang
10/26/2023, 2:41 PMburkybang
10/26/2023, 2:44 PMerictgrubaugh
10/26/2023, 2:45 PMburkybang
10/26/2023, 2:48 PMjen
10/26/2023, 8:52 PMincludes()
. Thought there might be a handy-dandy way.jen
10/26/2023, 8:53 PMjen
10/26/2023, 8:54 PMjen
11/01/2023, 3:22 PMjen
11/01/2023, 3:22 PMjen
11/01/2023, 3:22 PMburkybang
11/01/2023, 3:23 PM