Additional Comments Email Notifications to Contact and Watch List

Samiksha2
Mega Sage

Hi,

I need a help in advance condition in the notification.

When a contact post additional comment then the email should trigger to Watch List user and when watch List person comment then additional comment notification should trigger to contact.

I have written a advance condition.
Email to Watch List when Public Comment:(who will receive: Watch List )

if (current.sys_updated_by == current.contact.user_name) {
answer = true;
}
else {
answer = false;
}

Email to Contact when Public Comment:(who will receive: Contact)

Watchlist is referencing to sys_user table. what will be the condition here. 

 

Please help me.

 

Thanks!

Samiksha

5 REPLIES 5

Samiksha2
Mega Sage

Please help in this, How I can compare the user table user name with the contact table user name

Riya Verma
Kilo Sage
Kilo Sage

Hi @Samiksha2 ,

 

Hope you are doing great.

 

To trigger an email notification to the users on the Watch List when a contact posts an additional comment, and to notify the contact when a Watch List person comments, we can use an advanced condition in the notification setup.

 

  1. For the "Email to Watch List when Public Comment" notification, the condition can be implemented as follows:
var answer = false;
if (current.sys_updated_by == current.contact.user_name) {
    answer = true;
}

      2. For the "Email to Contact when Public Comment" notification, since the Watch List is referencing the sys_user table, the condition can be modified as follows:

var answer = false;
var watchListUserNames = [];
var watchListGr = new GlideRecord('sys_user');
watchListGr.addQuery('user_name', current.sys_updated_by);
watchListGr.query();
while (watchListGr.next()) {
    watchListUserNames.push(watchListGr.user_name.toString());
}
if (watchListUserNames.indexOf(current.contact.user_name) > -1) {
    answer = true;
}

 

 

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma

Hi @Riya Verma ,

Thank you for your reply.

1st scenario is working but 2nd is not working. 

 

When watchlist user is adding the comment notification is not triggering to Contact

@Samiksha2 ,

can u please try using below condition for 2nd point :
answer = (current.watch_list_field == current.contact.sys_id);

Please mark the appropriate response as correct answer and helpful, This may help other community users to follow correct solution.
Regards,
Riya Verma