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

Yes i am using it in email scripts.

var duration;

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

Sohail Khilji
Kilo Patron

try this :

 

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

 


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect

It didn't work . It doesn't work if i enable app admin. It works fine if i don't enable app admin. I want this to work when app admin is enabled.

This is strange, check with HI support !


☑️ Please mark responses as HELPFUL or ACCEPT SOLUTION to assist future users in finding the right solution....

LinkedIn - Lets Connect