BankStatementParserInput
Type |
Interface input object |
Description |
Input object for parseBankStatement. When NetSuite requests the bank statement content, this object obtains the bank statement file content and default settings from the file. |
Methods |
|
Parent Object(s) |
N/A |
Child Object(s) |
N/A |
getFile
Function Declaration |
|
Type |
Object method |
Description |
This method gets the imported file content to the parser plug-in. |
Returns |
nlobjFileInterface – A file object containing the bank statement content. You can also use a file API to stream large files. For more information on streaming large files, see N/file Module. |
Input Parameters |
None |
Parent object |
Example
var statementFile = context.input.file;
var statementLineIterator = statementFile.lines.iterator();
statementLineIterator.next();
statementLineIterator.each(function (line) {
log.debug({
title: 'Read a line from the statement',
details: line.value
});
getFormatProfileId
Function Declaration |
|
Type |
Object method |
Description |
This method passes the ID of the format profile, which the user selected at the time of import. To get related configurations to parse the bank or credit card statement, the script can use this ID combined with SuiteScript. These configurations could include date format, currency precision, and other user-defined configurations. |
Returns |
int – the ID of the format profile, which the user selected at the time of import. |
Input Parameters |
None |
Parent object |
Example
The following example is a generic implementation of the getFormatProfileId method:
var formatProfileId = context.input.formatProfileId;
log.debug({
title: 'Format Profile Id',
details: formatProfileId
});
The following example uses the getFormatProfileId method to get parser configuration values from a format profile record:
function getParserConfigs(context) {
var ftid = context.input.formatProfileId;
var ppid = 'customscript_bsp_parser_bai2';
var configs = {};
search.create({
type : 'customrecord_bsp_configuration_value',
filters : [
['custrecord_bsp_config_ftid', search.Operator.IS, ftid],
'and',
['custrecord_bsp_config_ppid', search.Operator.IS, ppid]
],
columns : [
'name',
'custrecord_bsp_config_value'
]
}).run().each(function (result) {
var name = result.getValue('name');
var value = result.getValue('custrecord_bsp_config_value');
configs[name] = {
id : result.id,
value : value
};
return true;
});
return configs;
};
In the preceding example, the custom record customrecord_bsp_configuration_value
has a foreign key called custrecord_bsp_config_ftid
that connects it to the format profile. A User Event script is deployed to display these records in the Configuration subtab on the Format Profile page, where users set their values.
The function getParserConfigs
is triggered when the import process starts. When triggered, the function locates the configurations necessary for parsing the imported statement, according to the specified file format. In the preceding example, customscript_bsp_parser_bai2
stands for BAI2.