Hi all, I can do this in my suitescript 2.1 client...
# suitescript
d
Hi all, I can do this in my suitescript 2.1 client script
Copy code
const exportToExcel = () => {
    const totalLines = nlapiGetLineItemCount('custpage_transaction_list');
    alert(totalLines);
}
but is there a way to convert the
nlapiGetLineItemCount
to equivalent suitescript 2 API ?
a
Record.getLineCount(options) CurrentRecord.getLineCount(options)
This from the help center
s
@dennysutanto there is a help page called something close 1.0 to 2.0 mapping. Just search for that and you will find all the related APIs
d
but as my snippet above, i have no access to either Record nor CurrentRecord
exportToExcel is a function in my client script which will be called from suitelet on click of a button
b
d
@battk you're saying that
currentRecord
is automatically available in my exportToExcel function in client script ?
i remember i tried to
log.debug('test', currentRecord)
showed me empty
b
you should have access
N/currentRecord
its easiest if you are using Form.clientScriptModulePath
but you also have access to netsuite's module via
window.require
d
@battk you're saying that i should include N/currentRecord in define function like this ?
define(['N/url', 'N/runtime', 'N/currentRecord'],
b
yes
d
@battk ok, i have added currentRecord in define function, and in my function i have this
Copy code
const exportToExcel = () => {
            log.debug('currentRecord', JSON.stringify(currentRecord));
it shows empty {}
b
sounds normal so far
N/currentRecord has one key,
get
whose value is a function
and functions dont stingify
d
@battk yes, it works, as always you're very helpful Thanks