Event parm 1 and parm 2 are both inactive - how to send to a default address

Nen
Tera Guru

Hi All,

I have a working script wherein I'm sending an email to the recipients from the event fired. I have both the Event parm 1 contains recipient and Event parm 2 contains recipient checboxes checked. I know that inactive users will not be able to receive the emails and I noticed that when both recipients from the event parameters are inactive, the certain iteration will be "skipped" (no email will be sent out). Is it possible to have a default "To" recipient for this case?

I'm adding a Cc on the mail script but I'm assuming an email will not be sent out when it has no "To" recipient even if it has a "Cc" that's why that certain email is being skipped.

Thanks!

1 ACCEPTED SOLUTION

Hi,

That's the correct approach.

So first do the check of the values of the group and user.

If both are inactive, then you will trigger the event like below

gs.eventQueue("your_event", gr, "static_email","group_and_user");

Make both group and user concatenate with some delimiter "-".

if one of them is active, then do like below.

gs.eventQueue("your_event", gr, "group","user");

Then in your notification, have both parm1 and parm2 are recipients.

And in your mail script, do something like this.

 

var parm2 = event.parm2;

parm2=parm2.split("-");

if(parm2.length>1) {

//then it means both are inactive, so group contains in parm2[0] and user value contains in parm2[1]

}

Mark the comment as a correct answer and also helpful if it solves your problem.

View solution in original post

9 REPLIES 9

Hi. Thanks for the reply. I am passing a group for the parm1 and a user for the parm2. I've tried checking if both are inactive but I still need to pass the group and user (as well as the default email address where I want to send the email) since I'm using the group and user in a different query on my mail script.

I've thought of storing the group and user on an array and use them as parm1 and use the default email add as the parm2. If both are inactive, then I'll have values for both parm1 and parm2. But if not, only the parm1 will have a value. So far I've been successful in passing it to the script but I'm having trouble checking the values so I can have different steps for each scenario

Hi,

That's the correct approach.

So first do the check of the values of the group and user.

If both are inactive, then you will trigger the event like below

gs.eventQueue("your_event", gr, "static_email","group_and_user");

Make both group and user concatenate with some delimiter "-".

if one of them is active, then do like below.

gs.eventQueue("your_event", gr, "group","user");

Then in your notification, have both parm1 and parm2 are recipients.

And in your mail script, do something like this.

 

var parm2 = event.parm2;

parm2=parm2.split("-");

if(parm2.length>1) {

//then it means both are inactive, so group contains in parm2[0] and user value contains in parm2[1]

}

Mark the comment as a correct answer and also helpful if it solves your problem.

Hi! If I concatenate the group and user using a "-" delimiter, does that mean they won't be considered as a "valid" recipient anymore? Since I've read somewhere that the format should be a comma-separated list of recipients.

Yes, it won't be considered valid.

Hence we are concatenating with delimiter "-" only when both are inactive. In that case, anyway they both don't get mail. So event2 parm will be considered invalid and mail will not go.

you can also concatenative with , as delimiter, that will also work. 

Okay, I get it now. And it seems to be working fine now. Thank you so much for your help!