Issue facing on after insert business rule

Ap_1
Tera Contributor

I am trying to fetch single email from sys_email_log table.

 

Script:

 

updateCounter();
function updateCounter() {

var logGR = new GlideRecord('sys_email_log');
logGR.addQuery('email', current.sys_id);
logGR.query();
    if (logGR.next()) {
        gs.info("Inside if");
    }
    else {
        gs.info("Inside else");
    }
}
 
The BR is written on sys_email table. Everytime it is going on the else condition.
 
Can anyone please help me on this urgently.
3 REPLIES 3

Ap_1
Tera Contributor

Hi Danish,

 

On sys_email_log table, Email filed is the sysid of the record on sys_email table.

I have tried by giving the filter, by -

 

logGR.addQuery('email', current.sys_id);

 

or, logGR.addQuery('email.sys_id', current.sys_id);

 

Both didn't work

 

Thanks,

Aparajita

Hi @Ap_1 ,

 

Yes you are correct ,

Apologies I just checked now.

Can u try replacing this line n check if it works

if (logGR._next()) {

 

Thanks,

Danish

 

@Ap_1 

 

Also the email record does exist in email logs table right.hope u have checked it manually.

 

Thanks,

Danish