Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Not able to send email to email.from as well as email.CC using gs.eventQueue()

spimple
Tera Contributor

I have a scenario in which if i get a email from customer to create a case. Then I trigger a event which triggers the notification to send the email body.

 

I have tried below code:

if (contact.next()) {
if (contact.account.u_account_segment == 'Small Enterprise') {
gs.eventQueue('event_name', null, null, email.from);
var ccEmails = email.CC.split(",");

for (var i = 0; i < ccEmails.length; i++) {
gs.eventQueue('event_name', null, null, ccEmails[i].trim());
}
}
return;

}

 

but i am only able to send the email to email.from . I am not getting the emails for CC people

 

 

what should i modify so that i get emails for email.from and email.CC people 

 

 

8 REPLIES 8

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @spimple 

https://www.servicenow.com/community/developer-forum/add-users-to-cc-d-in-email-notification/m-p/218...

 

https://jessems.com/posts/2023-07-12-how-to-set-the-cc-field-on-an-email-notification-in-servicenow#....

 

https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0783517

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hello Atul, Actually I am triggering an event using
gs.eventQueue('eventName',current,email.from); and gs.eventQueue('eventName',current,email.copied);

but I have been told that I dont need to create two queues as it will shoot two emails. they want one email wit email.from and email.copied (cc)
So in inbound email action i am triggering the even and it is assiociated with the notification which has the body.

The thing is i have been told that I should try to set CC from Notification email script.

How do i set email.from and email.copied from Email script after triggering the event?

@Sohail Khilji inputs plz.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Hi @spimple ,

 

Instead of using email.from or email.copied try using email.to > This actually contains email addresses from both from and cc. I hope this helps...

 

 

 

 

 

 

 

 

 


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

LinkedIn - Lets Connect