Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

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

Swathi P
Kilo Sage

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

Not applicable

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

 

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.

Not applicable

This is strange, check with HI support !