Trigger email notification for reference fields

ar1
Kilo Sage

Hi All,

We have one table with three reference [ Sub user, Req User and Cust User ]fields and the requirement is:

1. When "User communication" is added to the record we need to send email to "Sub User" field user. [We created email notification and it's working fine].

2. When "Sub User" field user reply directly to the email from outlook that he received, we need to send another email to Req User and Cust User fields users.

Can anyone please help us how to check the "Sub user" reply to user communications email.

Advance thanks.



1 ACCEPTED SOLUTION

@ar1 

update as this

var deUser = current.req_user;
var portUser = current.portfolio.cust_user;

current.comments ="received from: " + email.origemail + "\n\n" + email.body_text;


gs.eventQueue('req_cust_user_email',current,demandUser + ',' + portUser);

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

View solution in original post

5 REPLIES 5

Ankur Bawiskar
Tera Patron
Tera Patron

@ar1 

for the 2nd point you must have configured inbound email action on that table.

In that inbound action script you can use gs.eventQueue() and trigger the event to the other users

did you start on this?

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,
Many thanks for the response.

As per your suggestions, we created one Event and coming to the inbound email action.
We created forward email action but we're not sure how to call the "Req user and Cust user" fields in gs.eventqueue();

 

ar1_0-1678085193678.png

 



Could you pls help us.

Advance thanks.

@ar1 

your inbound action will be of type reply

your event will be on that table on which email was sent

Then in inbound action you can access field values of that record using current object and include those users as recipient list.

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Hi Ankur,
Thanks for the response.
Could you pls check the below inbound email script once:


var deUser = current.req_user;
var portUser = current.portfolio.cust_user;

current.comments ="received from: " + email.origemail + "\n\n" + email.body_text;

gs.eventQueue('req_cust_user_email',current,demandUser,portUser);

Advance thanks.