BankStatementParserInput

getFile

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

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.

Related Topics

parseBankStatement
BankStatementParserOutput

General Notices