Decrypt the email address from cryptstring id=<%= escapeUrl(cryptString(targetData.email)) %>
Hi there,
"I am passing the recipient's email through a survey URL generated in Adobe Campaign and need to decrypt this email address. I'm using a JavaScript function to extract the email parameter from the URL, decrypt it, and send the data to a table. However, the decrypted string is still appearing as an encrypted string for some reason."
?email_id=<%= escapeUrl(cryptString(targetData.email)) %>

function decryptString(encryptedEmail) {
// Implement your decryption logic here
return encryptedEmail; // Placeholder: returning the input as-is
}
// Function to decrypt and extract the email address from the URL
function getEmailFromUrl() {
const params = new URLSearchParams(window.location.search);
const encryptedEmail = params.get('email_id');
// Decrypt the email address using the decryptString function
const email = decryptString(encryptedEmail);
return email;
}
// Function to validate the survey, set values, and submit the form
function validate() {
// Get the email address from the URL
const email = getEmailFromUrl();
if (!email) {
alert("Error: Email address is missing.");
return false;
}
if (isValid) {
// Set the email address to the "Email_Address" path
document.controller.setValue("/ctx/FOD_SurveyResponse/@Email_Address", email);
// Submit the form if validation passed
document.controller.submit('next', '_self', 'next');
}
return isValid;
}