Update E-Document Certification Statuses

This script sample script shows how to update e-document certification status.

This script can also be found at Updating E-Document Certification Statuses as part of the Electronic Invoicing Administrator Guide.

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.

The following code is a sample script to implement e-document certification status updates.

          /**
* Copyright (c) 2017, Oracle and/or its affiliates.
*
* @NApiVersion 2.x
* @NScriptType plugintypeimpl
* @NModuleScope public
*/
define([], function() {
   /**
    * send - This function is the entry point of our plugin script
    * @param {Object} plugInContext
    * @param {String} plugInContext.scriptId
    * @param {String} plugInContext.sendMethodId
    * @param {String} plugInContext.eInvoiceContent
    * @param {Object} plugInContext.customer
    * @param {String} plugInContext.customer.id
    * @param {Array} plugInContext.customer.recipients
    * @param {Object} plugInContext.transaction
    * @param {String} plugInContext.transaction.number
    * @param {String} plugInContext.transaction.id
    * @param {String} plugInContext.transaction.poNum
    * @param {Object} plugInContext.sender
    * @param {String} plugInContext.sender.id
    * @param {String} plugInContext.sender.name
    * @param {String} plugInContext.sender.email
    * @param {Array} plugInContext.attachmentFileIds
    *
    * @returns {Object} result
    * @returns {Boolean} result.success
    * @returns {String} result.message
    */
   return {
       send: function(pluginContext) {
           var result = {
               success: true,
               message: '',
               eiStatus: {
                   "transactionId": plugInContext.transaction.id,
                   "transactionType": plugInContext.transaction.tranType,
                   "entity": customer.id,
                   "eDocStatus": "3",
                   "eventType": "3",
                   "details": "The e-Doc successfully certified and is ready for sending.",
                   "owner": plugInContext.sender.id,
                   "isUpdateFields": "true",
                   "extraFieldsForUpdate": {},
                   "bundleId": "",
                   "bundleName": ""
               }
           };
           return result;
       }
   }
}); 

        

General Notices