The CreatorCon Call for Content is officially open! Get started here.

What are the equivalent variables in email scripts?

Liuduan
Kilo Expert

        What are the equivalent variables in email scripts?

         Fields in sc_request table can be easily accessed from workflow or notification, but how to access them in email scripts?

For example:

In notification: ${sysapproval.description}, ${sysapproval.short_description}

In workflow script: current.description, current.short_description

In email script: ???, ???

         They all correspond to the description or short_description column in the sc_request table. What is the equivalent of them in the email scripts?

1 ACCEPTED SOLUTION

Dear Mr. Harshvardhan,

      Thank you for your help. The following code is working. I can read the sc_request table columns.

      You are great.

      Liuduan

var req = new GlideRecord("sc_request");

req.addQuery('sys_id', current.sysapproval.sys_id);
req.query();

gs.info("test 1: ");    
while(req.next()) {
    gs.info("test 2: " + req.short_description);  
}

View solution in original post

14 REPLIES 14

This line in above code give me hundreds of answers, and some of them are right answers.

req.addQuery(current.getUniqueValue());

 

This line in above code do not give me any answer:

req.addQuery('sys_id', current.getUniqueValue());

 

Liuduan
Kilo Expert

I am sorry, the same result as last time.

Liuduan
Kilo Expert

sc_request table seems have two sys_id columns.

I called the mail script in the email template like this:

${mail_script:my_email_script} 


can you add screenshot here , how are you checking the output. did you use template.print() instead of gs.info(). 

 

please add some screenshot here. and your notification is running on which table ?