Advanced Condition on Email Notification Not Working

cnharris1
Kilo Sage

Good morning developers,

 

I'm looking for some guidance on an email notification.

The background information is that whenever a new customer order is submitted, it sends out a notification to the Billing Department to approve the order. That part works fine. But I just received a new requirement that the Billing Department only needs to receive a notification on new orders if their customer classification is public.

 

The part that I'm having trouble with is that the customer classification is public comes in on the order as a product characteristic value, which is on a separate table. It's still associated with the order but it's not on the customer order table to where I can dot-walk it down, so I had to write a script. Even with my script, an email notification is still being sent out when the customer classification characteristic value is empty. I only need to send the notification out if the customer classification is public.

Can someone guide me on what I'm doing wrong with this script?

Here's the script that I'm using:

var exp = new GlideRecord("sn_ind_tmt_orm_order_characteristic_value");

exp.addEncodedQuery('characteristic_option_value=Public');

exp.query();

if(exp.next()){

answer = true;

}

else{

answer = false;

}

 

And here's the full email notification: 

 

cnharris1_0-1682435947315.png

 

Any help will be greatly appreciated!

 

Best regards,

 

cnharris1

1 ACCEPTED SOLUTION

cnharris1
Kilo Sage

Just in case this helps someone else, but I was able to build the notification from the sn_ind_tmt_orm_order_characteristic_value table and filter out the customer classification is Public without scripting.

View solution in original post

1 REPLY 1

cnharris1
Kilo Sage

Just in case this helps someone else, but I was able to build the notification from the sn_ind_tmt_orm_order_characteristic_value table and filter out the customer classification is Public without scripting.