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

"and your notification is running on which table ?"

I am not sure. I thought it is running on Approval table or sc_request table.

How can I find out?

Liuduan
Kilo Expert
req.addQuery(current.sys_id);

This line also give me many answers and some of them are right answers. I use gs.info() to get the answer. template.print() should have the same answer.

try now

 

gs.info('sys id '+ current.sys_id);
var req = new GlideRecord("sc_request");
req.get(current.sys_id);
gs.info("test 7.9.3: ");  
gs.info("test 7.9.4: " + req.short_description);  
 

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);  
}

Liuduan
Kilo Expert

I am sorry. I need to go to bed now, because I have to get up early tomorrow.

I will reply tomorrow evening.

Thank you very much.