SCRIPT TO ENCRYPT A FILE IN NETSUITE

HOW TO ENCRYPT A FILE IN NETSUITE USING SCRIPT? – NETSUITE ACADEMY

Netsuite scripting provides the ability to encrypt any file stored in file cabinet.

Feel free to reach out netsuite solution providernetsuite implementationnetsuite consultation , netsuite customizationnetsuite Support, netsuite Training  

You would need the file id for this purpose. This file id can be hard coded or obtained using search as per the requirement. The default algorithm used for encrypting is SHA-1 method. The other available methods are base64, aes, xor. The below code shows how to encrypt a file using Advanced Encryption Standard (AES) method.




{
                  var loadfile = nlapiLoadFile(fileid);  // can be used only in server side script
     
    var filevalue = loadfile.getValue();
    
    var encrypted_text = nlapiEncrypt(filevalue, “aes”);
    
                   var filename = loadfile.getName()+’_encrypted’;
          
                 nlapiLogExecution(‘DEBUG’, ‘filename’, filename);
            
                var file_folderid = loadfile.getFolder();
            
                var encrypted_file = nlapiCreateFile(filename, ‘PLAINTEXT’, encrypted_text);
           
                  encrypted_file.setFolder(file_folderid);
           

                  var encryptfileid = nlapiSubmitFile(encrypted_file);

}

contact us at:

Email : info@smilingcoders.com

Facebook : https://www.facebook.com/Smiling-Coders-Netsuite-Training-Implementation-and-Support-1591053827660082/

Linkedin : https://www.linkedin.com/company/netsuite-academy/


Leave a Reply