NetSuite Plugins

The Quality Management SuiteApp can leverage plug-ins to customize behavior that meets your organization’s needs. It is important that you are familiar with SuiteScript and have a basic understanding of NetSuite Custom Plug-ins.

To learn more, see Core Plug-in Overview

Quality Custom Inspection Rule Plug-in

The Quality Custom Inspection Rule plug-in enables you to evaluate quality inspection data and standards to determine if an inspection should pass or fail. Only use this plug-in when conventional pass rules are insufficient. For example, length greater than or equal to Max_Length.

Requirements

Since the Quality Management SuiteApp uses SuiteScript 2.0, all custom plug-in implementations must also be written in SuiteScript 2.0.

Expected Input/Output

A new implementation of the custom inspection rule must take as input the following:

Field

Action

InspectionObject

A JavaScript object containing inspection information requesting specialized pass/fail assessment:

  • type: the inspection type

  • name: the inspection name

  • txnld: the triggering transaction internal ID

  • itemID: the triggering item internal ID

fieldObject

A JavaScript object containing triggering inspection field information:

  • name: the field name

  • value: the field value

otherFieldObjects

An array of JavaScript objects containing additional inspection field information. One entry for every piece of related inspection data collected:

  • name: the field name

  • value: the field value

standardObjects

An array of JavaScript objects containing standard fields of the inspection information. One entry for every standard defined:

  • name: the field name

  • value: the field value standard adjusted for any item specific settings

Each custom inspection rule must also return a Boolean (true or false):

Sample Implementation

The Quality Management SuiteApp includes a sample alternate implementation of the Quality Custom Inspection Rule Echo plug-in.

By adding this plug-in to your sandbox account, you will see a full echo of all the inputs that trigger the plug-in. You can review this in the plug-in implementation script execution to ensure you understand the data available to the plug-in.

You can review this implementation for the correct structure of the SuiteScript 2.0 script which can be used as a template. This enables you to concentrate only on the rule-specific logic of your organization. The script code is shown in the Quality Custom Inspection Rule Echo Source section.

Quality Custom Inspection Rule Echo Source

Note:

This sample script uses the define function, which is required for an entry point script (a script you attach to a script record and deploy). You must use the require function if you want to copy the script into the SuiteScript Debugger and test it. For more information, see SuiteScript Debugger.

This implementation simply echos all inputs to the log to assist new developers and returns true.

          /**
* @NApiVersion 2.x
* @NScriptType plugintypeimpl
*
* ECHO Implementation of Custom Rule Plug-in for Quality Management SuiteApp
   */
define(['N/log'], function(log) {
      return {
         inspectionPassed: function(inspectionObj, fieldObj, otherFieldObjs, standardObjs) {
            // echo inspectionObj
            log.debug({
                     title: 'insepctionObj',
                     details: 'type:' + inspectionObj.type +
                           ' name:' + inspectionObj.name +
                           ' txnId:' + inspectionObj.txnId +
                           ' itemId:' + inspectionObj.itemId
            });

            // echo fieldObj
            log.debug({
                     title: 'fieldObj',
                     details: 'name:' + fieldObj.name +
                                    ' value:' + fieldObj.value
            });

            // echo otherFieldObjs
            for ( var i in otherFieldObjs ) { 
                     log.debug({
                                    title: 'otherFieldObjs',
                                    details: 'name:' + otherFieldObjs[i].name +
                                                   ' value:' + otherFieldObjs[i].value
                     });
            }

            // echo standardObjs
            for ( var i in standardObjs ) {
                  log.debug({
                              title: 'standardObjs',
                              details: 'name:' + standardObjs[i].name +
                                             ' value:' + standardObjs[i].value
                  });
            }
            return true;
         }
      }
}); 

        

Related Topics

Quality Management REST API
Quality Management Overview
Quality Management User Guide

General Notices