Inbound Validation Plug-ins

The Electronic Invoicing SuiteApp provides support for plug-ins that can perform inbound e-document validation according to the requirements of tax agencies or standards regulatory bodies.

You can create or customize a plug-in that communicates with external sites or systems of a third party, such as a tax agency, which validates e-documents and then returns the results to the plug-in. Or you can create or customize a plug-in that itself performs the required e-document validation.

An inbound e-document validation plug-in must be set up first and integrated with a vendor e-document package. With the validation plug-in set up, every time a user converts inbound e-documents to vendor bills or vendor credits, the plug-in automatically triggers the validation process that is transparent to the user. Depending on your implementation of the plug-in, it can either send the XML e-documents to a validating third party or validate them locally.

The result of the validation process can be viewed from the status of the inbound e-document. If the inbound e-document passed validation, then parsing and conversion will proceed. However, if the inbound e-document is invalid, conversion will not proceed and the status of the inbound e-document will be set to Conversion Failed. The audit trail of the inbound e-document will indicate the details of a failed local conversion process or information from a validating third party.

Note:

Inbound Validation plug-ins are not supported for inbound record with sales order transaction type.

Creating a Custom Plug-in for Inbound E-Document Validation

A custom plug-in implementation for validating inbound e-documents must be created so that it will be available in the vendor e-document package.

A validation custom plug-in implementation script is included in Electronic Invoicing SuiteApp. Use the sample script as a reference or a template for creating your own custom validation plug-in.

The validation plug-in must be a JavaScript file that is compatible with SuiteScript 2.0.

To open the sample validation plug-in script, go to Documents > Files > File cabinet > SuiteBundles > Bundle 436209 > src > comp > pl > pl_inbound_validation_sample.js. Open the script in a programming editor to view the script.

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 SuiteScript Debugger.

The following code is a sample validation plug-in script.

          /**
 * Copyright (c) 2017, Oracle and/or its affiliates.
 * 
 * @NModuleScope public
 * @NApiVersion 2.x
 * @NScriptType plugintypeimpl
 */

define([], function() {
    /**
     * validate - This function is the entry point of our plugin script
     * @param {Object} plugInContext
     * @param {Object} plugInContext.eDocument
     * @param {String} plugInContext.eDocument.id
     * @param {String} plugInContext.eDocument.scriptId
     * @param {String} plugInContext.eDocument.content
     * @param {Object} plugInContext.eDocument.source
     * @param {String} plugInContext.eDocument.source.id
     * @param {String} plugInContext.eDocument.source.text
     * @param {Object} plugInContext.eDocument.template
     * @param {String} plugInContext.eDocument.template.id
     * @param {String} plugInContext.eDocument.template.text
     * @param {Object} plugInContext.eDocument.status
     * @param {Integer} plugInContext.eDocument.status.id
     * @param {String} plugInContext.eDocument.status.text
     * @param {Object} plugInContext.eDocument.package
     * @param {String} plugInContext.eDocument.package.id
     * @param {String} plugInContext.eDocument.package.text
     * @param {Object} plugInContext.eDocument.transactionType
     * @param {String} plugInContext.eDocument.transactionType.id
     * @param {String} plugInContext.eDocument.transactionType.text
     * @param {Object} plugInContext.eDocument.vendor
     * @param {String} plugInContext.eDocument.vendor.id
     * @param {String} plugInContext.eDocument.vendor.text
     * @returns {Object} result
     * @returns {Boolean} result.success
     * @returns {String} result.message  
     */
    function validate(pluginContext) {
        
        var eDoc = pluginContext.eDocument;
        var result = {
                success: false,
                message: ""
        };
        
        
        // Connect to validation service
        
        
        // If successful
        result.success = true;
        result.message = "Validation successful!";
        
        
        // Sample result if not successful
        // result.success = false;
        // result.message = "Service returned a failed response"; 
        
        
        return result;
    }
    
    
    return {
        validate: validate
    };
    
}); 

        
Important:

The validation custom plug-in script must have the @NSScriptType plugintypeimpl.

You can create as many validation plug-ins implementation as needed in your e-document processing, but you can only assign one validation plug-in implementation per e-document package.

After creating the custom validation plug-in script, upload it to Customization > Plug-ins > Plug-in Implementations > New . The type of the custom plug-in implementation must be “Validation Plugin”. For more information, Custom Plug-in Creation.

Setting Up the Inbound E-Document Validation Plug-in

Before inbound e-document processing can use the validation plug-in you created, you must set up the plug-in first and then integrate it with an e-document package.

To set up the inbound e-document validation custom plug-in and integrate it with a vendor e-document package:

  1. Go to Setup > E-Documents > Inbound E-Document Validation Plugin > New.

  2. On the Inbound E-Document Validation Plugin page, enter the name of the plug-in in the Name field. In the Script field, select the plug-in you created from the dropdown list.

  3. Click Save.

  4. Go to Setup > E-Documents > E-Document Package.

  5. On the E-Document Package List page, click the Edit link of the vendor e-document package that you want to integrate the inbound e-document validation plug-in with.

  6. On the E-Document Package page, in the Inbound E-Document Validation Plugin Implementation field, select the custom plug-in you created.

  7. Click Save.

The validation process or logic that you programmed into the plug-in will now be integrated with the inbound e-document conversion process.

Related Topics

General Notices