Notification is not working with advanced condition

Aruna13
Tera Contributor

Hi,

 

I have a business requirement to create some notifications for a custom table we have, and the notification should not send to particular email addresses. I have stored those restricted email addresses under a system property. Now, I need to have the advanced condition to check the list of emails stored in system property and do not send notification to the same, if the email is not listed in the system property, then it should send the notification.

 

Note: The customer do not want me include those email address in condition as it can be removed mistakenly, so they asked me to have a system property and use an advanced condition.

 

Can anyone please help with the advanced condition?

 

Thanks in Advance!!

 

 

1 ACCEPTED SOLUTION

Hi @Aruna13 ,

 

Try this way :

 

var email= gs.getProperty('ar.donot.send.notification').toString().split(',');

var from = current.email_from.getDisplayValue();

var arrEmail = [];

for(var i=0; i < email.length; i++){

if(from == i ){

add the found email to arrEmail and send email to the array list...

}       

}

(do your action...)


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

LinkedIn - Lets Connect

View solution in original post

7 REPLIES 7

Aruna13
Tera Contributor

I need to have advanced condition and the link you provided doesn't seem helpful for my query.

I already wrote this script, but it is not working. Don't know what is wrong here, Need help since i am creating this custom notifications for the first time.

 

var excludedEmails = gs.getProperty('ar.donot.send.notification'); gs.log('aruna');
if (excludedEmails){
    var emailList = excludedEmails.split(',');//split the string into an array of emails
    var currentEmail = current.email_from.getDisplayValue() && current.u_caller_id.getDisplayValue;

//check if current email is in excluded list
    if(emailList.indexof(currentEmail) === -1){
    //condition passes if the current email is not in the excluded list
    condition = false;
    }else{
    condition = true;//condition fails if the current email is in the excluded list
    }
}else{
    //If the system property is not set or empty, condition passes by default
    condition = true;
}

Hi @Aruna13 ,

 

Try this way :

 

var email= gs.getProperty('ar.donot.send.notification').toString().split(',');

var from = current.email_from.getDisplayValue();

var arrEmail = [];

for(var i=0; i < email.length; i++){

if(from == i ){

add the found email to arrEmail and send email to the array list...

}       

}

(do your action...)


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

LinkedIn - Lets Connect

Aruna13
Tera Contributor

I tired and it is also not triggering any notification!! 😞