Catalog task variable editor Values should transfer to Email Part

Community Alums
Not applicable

Hi Team,

I have new variables in SCTASKs which are visible only in SCTASK and I need to Transfer filled value to Email 

 

kumar445_0-1699450814142.png

kumar445_1-1699450944818.png

In variables 

 

3 REPLIES 3

Ankur Bawiskar
Tera Patron
Tera Patron

@Community Alums 

email notification is on which table and when is the email triggering?

are you sure when the email triggers the variables have value in it?

please share your email script

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

Community Alums
Not applicable
Hi Ankur,
Please find my Code 
(function runMailScript(current, template, email, email_action, event) {

    // Add your code here

    template.print('Variables: <br/>');

    var variables = current.variables.getElements();
    for (var i=0;i<variables.length;i++) {
        var question = variables[i].getQuestion();
        var label = question.getLabel();
        var value = question.getDisplayValue();
if(label != '' && label=='please_provide_the_name_of_the_application_created_for_oss_mend'){
            template.space(4);
            template.print('  ' + label + " = " + value + "<br/>");
    }
    }
 
Thanks
Kumar

})(current, template, email, email_action, event);

Community Alums
Not applicable

Hi Ankur,

email notification is written on SCTASK table, and it should be trigged based on event. 

are you sure when the email triggers the variables have value in it? yes Value is there that value only visible on SCTASK

 email script is 



/
template.print('Variables: <br/>');

    var variables = current.variables.getElements();
    for (var i=0;i<variables.length;i++) {
        var question = variables[i].getQuestion();
        var label = question.getLabel();
        var value = question.getDisplayValue();
if(label != '' && label=='please_provide_the_name_of_the_application_created_for_oss_mend'){
            //template.space(4);
            template.print('  ' + label + " = " + value + "<br/>");
    }