Use of ‘decodeURIComponent’ in NetSuite

In NetSuite, the ‘decodeURIComponent’ function is used to decode URL-encoded parameters, converting them back to their original format. This is useful when retrieving query string values in SuiteScript that were previously encoded using encodeURIComponent. For example: The decoded value of the given encripted data is given below, Encrypted data or Encoded data: %7B%22relatedProjects%22%3A%5B%222709%22%5D%2C%22fields%22%3A%7B%22custrecord_project_status%22%3A10%2C%22custrecord_project_parent_charity_status%22%3A%2210%22%7D%2C%22newCharityStatus%22%3A%2210%22%2C%22PROJECT_COMPLETED%22%3A6%2C%22INELIGIBLE_CHARITY_STATUS%22%3A%5B9%2C7%2C8%2C12%5D%2C%22SUSPENDED%22%3A%5B10%5D%7D Decrypted data… Continue reading Use of ‘decodeURIComponent’ in NetSuite

AES Encryption and Decryption Using the N/crypto

/**  * @NApiVersion 2.x  * @NScriptType Suitelet  */ define([‘N/crypto’, ‘N/encode’, ‘N/log’], function (crypto, encode, log) {   function onRequest(context) {     let secretKey = crypto.createSecretKey({       guid: ‘f3e6c67a-1a47-4fd2-8b09-cdbcf36a3ef7’,       encoding: encode.Encoding.UTF_8     });     let textToEncrypt = ‘SensitiveData123’;     // Encrypt Data     let encrypted = crypto.encrypt({       algorithm: crypto.EncryptionAlg.AES,       key: secretKey,       input: textToEncrypt,       inputEncoding: encode.Encoding.UTF_8,       outputEncoding: encode.Encoding.BASE_64     });     log.debug(‘Encrypted:’, encrypted);     // Decrypt Data… Continue reading AES Encryption and Decryption Using the N/crypto