NetSuite Plugins

The Quality Management SuiteApp can use plug-ins to customize behavior for your organization’s needs. Make sure you’re familiar with SuiteScript and have a basic understanding of NetSuite Custom Plug-ins.

For more information, see Core Plug-in Overview

Quality Custom Inspection Rule Plug-in

The Quality Custom Inspection Rule plug-in lets you check quality inspection data and standards to decide if an inspection should pass or fail. Only use this plug-in if the usual pass rules aren’t sufficient. For example, when you need something like length greater than or equal to Max_Length.

Requirements

Since the Quality Management SuiteApp uses SuiteScript 2.0, all custom plug-in implementations need to be written in SuiteScript 2.0 too.

Expected Input/Output

A new custom inspection rule needs to take the following as input:

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 should also return a Boolean (true or false) value:

Sample Implementation

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

If you add this plug-in to your sandbox account, you’ll see a full echo of all the inputs that trigger it. You can check this in the plug-in script execution to make sure you understand what data's available.

You can use this implementation as a template for the right SuiteScript 2.0 structure. That way, you can focus on your organization’s rule logic. The script code is 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

General Notices