Creating Custom Plug-ins

To create custom plug-ins to use with NSPB Sync, you can do the following:

You can then use the plug-ins to process any data generated by a job and downloaded from Inbox/Outbox Explorer to NetSuite. For information, see Using Custom Plug-ins with NSPB Sync.

Note:

You can use post-processing plug-ins with the following job types:

  • Batch jobs

  • Business rules

  • Data load rules

Example of a Plug-in for Data Load Rule Export

The plug-ins you use for data load rule export should have the following format:

          /**
 * @NApiVersion 2.1
 * @NScriptType plugintypeimpl
 */

define([], function() {

  /**
   * Return configuration parameters of this plugin that are required by calling code
   *   E.g.: path to csv file in NSPB to be downloaded
   * @returns {Object} options - configuration parameters
   */
  function getConfiguration() {
    log.debug('running plugin getConfiguration');

    let options = {
      jobParams: {
        dataFilePath: 'nspbcsBudgetDm.csv', // path to csv file in NSPB to be downloaded
        dataFileHeaderLines: 1, // optional, number of header lines in data file
        dataChunkSize: 300, // optional, maximum number of records for each chunk of data to pass to processData per function call
        dataChunkGrouping: { // optional, enforce grouping records of the same value into the same data chunk
          enabled: true,
          groupFieldIndexes: [ // indexes of fields to use to determine data of the same group
            0, // account
            1, // class
            2, // subsidiary
            3, // location
            4, // department
            5, // tracker 
            6, // item
            7, // relationship
            8, // version
            9, // scenario
            10, // currency 
            11  // year
          ]
      }
    };
    return options;
  }

  /**
   * @Description Process any data generated by Data Management Module (Data Load Job)
   * @param {Object} options - the function parameters
   * @param {String} options.jobData - Data Load Job data retrieved from NSPB
   */
  function processData(options) {
    log.debug('processData', 'Running import budget data plugin processData with job data: ' + options.jobData);
    let budgetData = options.jobData;
  }

  return {
    getConfiguration: getConfiguration,
    processData: processData
  };

}); 

        

Example of a Plug-in for Business Rule Export

The plug-ins you use for business rule export should have the following format:

          /**
 * @NApiVersion 2.1
 * @NScriptType plugintypeimpl
 */

define([], function() {

  /**
   * Return configuration parameters of this plugin that are required by calling code
   *   E.g.: path to csv file in NSPB to be downloaded
   * @returns {Object} options - configuration parameters
   */
  function getConfiguration() {
    log.debug('running plugin getConfiguration');

    var options = {
      jobParams: {
        dataFilePath: 'nspbcsBudgetBr.csv', // path to csv file in NSPB to be downloaded
        dataFileHeaderLines: 2, // optional, number of header lines in data file
        dataChunkSize: 300 // optional, maximum number of records for each chunk of data to pass to processData per function call
      }
    };
    return options;
  }

  /**
   * @Description Process any data generated by a Business Rule
   * @param {Object} options - the function parameters
   * @param {String} options.jobData - Business Rule job data retrieved from NSPB
   */
  function processData(options) {
    log.debug('processData', 'Running import budget data plugin processData with job data: ' + options.jobData);
    var budgetData = options.jobData;
  }

  return {
    getConfiguration: getConfiguration,
    processData: processData
  };

}); 

        

Plug-in Script Configuration Details

Read the following details about configuration of plug-in scripts:

Related Topics

Using Post-Processing Plug-ins with NSPB Sync
Using NSPB Sync Post-Processing Plug-ins
Using Custom Plug-ins with NSPB Sync
Selecting a Plug-in for Data Processing
Troubleshooting Post-Processing Plug-ins
Setting Up Your Planning and Budgeting for Budget Data Import

General Notices