Getting the values of variables in a mail script

matthew_hughes
Kilo Sage

I've got the below mail script that current runs off a notification in the 'cmdb_ci_business_app' table. I want it to show the list of devices where the mentioned user in the notification is the 'Divisional Application Owner'. My script is below: 

 

if (current.u_business_owner.active == false || current.u_custodian.active == false || current.u_cmdb_data_steward.active == false)
template.print('<p>Click '); template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com' + '/cmdb_ci_business_app_list.do?sysparm_query=u_business_owner%3D" + current.u_business_owner + "&sysparm_first_row=1&sysparm_view=business_application_readonly" >'+ 'HERE'+'</a>'); template.print(' to view the list of Business Applications they are aligned to.</p>');

 

However, when I run the notification, the link appears to show the 'Divisional Application Owner' field as empty rather than running against the affected user:

 

Business Application query.png

I'm trying to get the sys ID of the current 'Divisional Application Owner' and put that in my query. I'm trying to do this with 'current.u_business_owner', but do I need to do it another way?

1 REPLY 1

Joe S1
Kilo Sage

Hello Matthew,

 

Try this see if it works better:

if (current.u_business_owner.active == false || current.u_custodian.active == false || current.u_cmdb_data_steward.active == false) {
        template.print('<p>Click ');
        template.print('<a href="https://' + gs.getProperty('instance_name') + '.service-now.com/cmdb_ci_business_app_list.do?sysparm_query=u_business_owner%3D' + current.u_business_owner + '&sysparm_first_row=1&sysparm_view=business_application_readonly" >' + 'HERE' + '</a>');
        template.print(' to view the list of Business Applications they are aligned to.</p>');
    }