Masked variables on Email notification

MARISA INACIO1
Tera Contributor

Hello everyone

 

I have a masked variable in my Task (not show on the form, just in Task) for the technician to write the password. When RITM closes, an email with the password goes out to the requested for. So far, so good.

However, in the Email notification where I define what goes out in the email, the password comes out with strange characters and not the password. I want it to be encrypted so that no one else can see it, only the person who receives the email with the password.

I have this email script

 

(function runMailScript(current, template, email, email_action, event) {

    // Add your code here
    email.subject = 'Teste título do email';
    var email_client = current.variables.email.getDisplayValue();
    var teste = current.variables.new_pass.getDisplayValue();
    template.print('Password: ' + teste);
    template.print('<br>');
    template.print('Email: ' + email_client);
})(current, template, email, email_action, event);

MARISAINACIO1_0-1708516898101.png

 


I've also tried it with this script when it has the encrypted password.

 

(function runMailScript(current, template, email, email_action, event) {
    // Add your code here
    email.subject = 'Teste título do email';
    var email_client = current.variables.email.getDisplayValue();
   
 var Encrypter = new GlideEncrypter();
var encrypted = current.variables.new_pass;
var decrypted = Encrypter.decrypt(encrypted);
   
    template.print('Password: ' + decrypted);
    template.print('<br>');
    template.print('Email: ' + email_client);
})(current, template, email, email_action, event);
 
 
MARISAINACIO1_1-1708517161856.png

 

 

Thanks in advance

Marisa

1 REPLY 1

Sohail Khilji
Kilo Patron
Kilo Patron

Can you try to run it in a background script to see if the decryption worked ?


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect