Creating a Custom Plug-in Alternate Implementation

Review the custom plug-in type's default implementation and any documentation provided by the solution provider.

To download a copy of the default implementation:

  1. Go to Customization > Plug-ins > Custom Plug-in Type.

  2. Click View next to the custom plug-in type you want to work with.

  3. On the Methods tab of this page, notice the names of the methods exposed in the default implementation. In your alternate implementation, you are required to use the same method names.

  4. On the Scripts tab, click download next to the default implementation file. Review this file to understand the default logic for each method.

  5. Click download next to the documentation file, if documentation has been provided by the solution provider. The documentation may provide additional information that explains what the methods are used for and what they return.

You can create a JavaScript file and re-implement the functions defined in the default implementation by creating an alternate implementation. The alternate implementation overrides the custom plug-in script’s default logic. You cannot change the function signatures and return types defined in the default implementation. You can only override the logic within the function bodies. Each function that is defined in the default implementation must be fully defined in the alternative implementation.

SuiteScript 2.x Custom Plug-in Alternate Implementation Example

The following is a SuiteScript 2.x example of a alternate implementation to the SuiteScript 2.x default implementation example shown in Creating a Custom Plug-in Default Implementation:

          /**
 * @NApiVersion 2.x
 * @NScriptType plugintypeimpl
 */
define(function() {
    return {
        doTheMagic: function(inputObj) {
            return 1234;
        },
        otherMethod: function() {
            return 'sample';
        }
    }
}); 

        

This sample default implementation fully defines the doTheMagic function. When called within the a script, this function always returns a result of 1234. This is different from the default implementation, which accepts two numbers as parameters, adds them together, then returns the result.

Related Topics

Custom Plug-in Overview
Custom Plug-in Creation
Custom Plug-in Implementation
Creating a Custom Plug-in Default Implementation
Adding the Alternate Implementation to NetSuite

General Notices