Mexico UUID Plug-in Implementation Sample Code

This section provides a sample code as a reference when you create a Mexico UUID plug-in implementation.

You can use a custom record to store transaction UUID values and retrieve them through SuiteScript. For more information about creating custom record types, see Custom Records.

In the following example, the getUUID(transactionType, internalId) function searches a custom record using transaction type and transaction internal ID as filters, then returns the UUID if found.

It is recommended to use search instead of load for better performance. For more information, see Mexico UUID Plug-in Implementation Best Practices.

Sample Code for Mexico UUID Plug-in Implementation:

          function getUUID(transactionType, internalId)
{
         var uuid = '';
         var filters = [new nlobjSearchFilter('custrecord_uuid_txn_type', null, 'is', transactionType), 
                      new nlobjSearchFilter('custrecord_uuid_txn_id', null, 'is', internalId)];

         var column = new nlobjSearchColumn('custrecord_uuid_id');
         var sr = nlapiSearchRecord('customrecord_uuid_container', null, filters, column); 
         if (sr && sr.length > 0) {
                 uuid = sr[0].getValue('custrecord_uuid_id');
         }
         return uuid;
} 

        

Related Topics

General Notices