Including Display Value of Fields from Other Tables

TStark
Kilo Sage

I have a notification on the demand (dmn_demand) table in which I'm trying to include the value of a field from another table. I'm not sure of which table to use and am not sure if my script is correct. I created a mail script and am calling it from within the notification, but apparently I am doing something wrong. Below is my script and a screenshot of the data (category) in which I need to be included in the notification.

AJ27_0-1699639500181.png

AJ27_1-1699639926251.png

 

 

 

4 REPLIES 4

Danish Bhairag2
Tera Sage
Tera Sage

Hi @TStark ,

 

Can u try below code once

 

var gr = new GlideRecord('asmt_metric_result');

gr.addQuery('source_id',current.sys_id);

gr.query();

if(gr.next()){

template.print(gr.metric.category.getDisplayValue());

 

Thanks,

Danish

 

Hi @Danish Bhairag2 I tried your script but it did not work. Thanks.

Sandeep Rajput
Tera Patron
Tera Patron

@TStark Update your code as follows.

 

(function runMailScript(current, template, email, email_action, event) 
{ 
var demand = new GlideRecord('asmt_assessment_instance_question');
demand.addQuery("source_id" , current.sys_id); 
demand.query();
if(demand.next()) {
template.print (demand.category.getDisplayValue());
}
})(current, template, email, email_action, event)

Hi @Sandeep Rajput I tried your script but it did not work. Thanks.