Expand my Community achievements bar.

Join us for the Adobe Campaign Community Q&A Coffee Break on 30th September at 8 am PT with Campaign experts Arthur Lacroix and Sandra Hausmann.
SOLVED

JS in Delivery activity

Avatar

Level 1

Hi Everyone,
       I tried implementing a access token to get copied by clicking on a button within the Recurring delivery activity. But the script is not working within that activity.
But I wanted the button within the email template .
Is there any other way ?
Kindly help me with your inputs

Below is the example code

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Copy Access Token</title>
</head>
<body>
<button id="copyButton">Copy Access Token</button>

<script>
document.getElementById('copyButton').addEventListener('click', function() {
// Create a temporary textarea element
var textarea = document.createElement('textarea');
textarea.value = 'yyttrrfftt65986!vaish';

// Make sure the textarea is not visible
textarea.style.position = 'fixed';
textarea.style.top = 0;
textarea.style.left = 0;
textarea.style.width = '1px';
textarea.style.height = '1px';
textarea.style.opacity = 0;
textarea.style.pointerEvents = 'none';

// Append the textarea to the document
document.body.appendChild(textarea);

// Select the text inside the textarea
textarea.select();

// Execute the copy command
document.execCommand('copy');

// Remove the textarea from the document
document.body.removeChild(textarea);


});
</script>
</body>
</html>

 

1 Accepted Solution

Avatar

Correct answer by
Community Advisor

Hello @vaishbharathi 

 

You cannot execute JS within a email. It is not supported.

 

The recipient of the email will have to use the traditional way of copying.


     Manoj
     Find me on LinkedIn

View solution in original post

1 Reply

Avatar

Correct answer by
Community Advisor

Hello @vaishbharathi 

 

You cannot execute JS within a email. It is not supported.

 

The recipient of the email will have to use the traditional way of copying.


     Manoj
     Find me on LinkedIn