Email script returns undefined when i enabled application admin in scoped application

Swathi P
Tera Guru

Hi Everyone ,

 

I have a custom application and there is an email notification on approver table which gets the non task table field values into the notification . It always returns undefined.

 

This is the sample code.

 

var leaveRequest = new GlideRecord('leave_request');
if(leaveRequest.get( current.document_id)) {
    gs.info("*****Test the Info");
    duration = leaveRequest.getValue('duration');
    gs.info("*************************Test Info Inside*** " +leaveRequest.getValue('duration'));
}

 

Pleas help.

8 REPLIES 8

Sandeep Rajput
Tera Patron
Tera Patron

@Swathi P 

var leaveRequest = new GlideRecord('leave_request');
if(leaveRequest.get(current.document_id)) {
    gs.info("*****Test the Info");
    var duration = leaveRequest.getValue('duration');
    gs.info("*************************Test Info Inside*** " +leaveRequest.getValue('duration'));
}

SunilKumar_P
Giga Sage

Hi @Swathi P ,

 

There is an extra space in line 2 in your script, test your code by removing it. 

 

var leaveRequest = new GlideRecord('leave_request');
//if(leaveRequest.get( current.document_id)) {
if(leaveRequest.get(current.document_id)) {
    gs.info("*****Test the Info");
    var duration = leaveRequest.getValue('duration');
    gs.info("*************************Test Info Inside*** " +leaveRequest.getValue('duration'));
}
 
Regards,
Sunil
 

Its not working. Its not getting inside If loop

 

Hi @Swathi P, where exactly are you running this script? is it in email scripts?

 

Regards,

Sunil