test an inbound email action in a pre-prod ServiceNow instance

vivek11
Tera Contributor

Hi Team,
I need help to test an inbound email action in a Test Environment instance. Can some help me?

Inbound email action name = Update Idea record work notes
Table = idea


Type = Reply


Action =

if (current.getTableName() == "idea") {
    // email reply to Work Notes
    current.work_notes = "Reply from: " + email.origemail + "\n\n" + email.body_text;
        current.update();
}

 

1 ACCEPTED SOLUTION

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @vivek11 

 

  • Activate the property in Pre-Prod to enable email.

  • Ensure the shared mailbox is added in the outbound properties—emails will go to the user, and this prevents confusion.

  • Set up the email account/server in Pre-Prod.

  • Create an incident in Pre-Prod and add yourself as the caller.

  • You will receive the email in the shared mailbox defined in the property.

  • Reply from the shared mailbox and check the inbound action.

 

*************************************************************************************************************
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]

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

View solution in original post

10 REPLIES 10

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @vivek11 

 

  • Activate the property in Pre-Prod to enable email.

  • Ensure the shared mailbox is added in the outbound properties—emails will go to the user, and this prevents confusion.

  • Set up the email account/server in Pre-Prod.

  • Create an incident in Pre-Prod and add yourself as the caller.

  • You will receive the email in the shared mailbox defined in the property.

  • Reply from the shared mailbox and check the inbound action.

 

*************************************************************************************************************
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 @Dr Atul G- LNG 
Thank you for quick reply,

i have done all this steps for IDEA record, but still it is not reflecting in worknotes. Could you please help me?

Activate the property in Pre-Prod to enable email.

Ensure the shared mailbox is added in the outbound properties—emails will go to the user, and this prevents confusion.

Set up the email account/server in Pre-Prod.

Hi @vivek11 

I’m not a developer, but you can cross-check your code against the OOTB (out-of-the-box) inbound action

 

 

gs.include('validators');

if (current.getTableName() == "incident") {
current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
 
if (gs.hasRole("sn_incident_write") || gs.hasRole("itil")) {
if (email.body.assign != undefined)
current.assigned_to = email.body.assign;
 
if (email.body.priority != undefined && isNumeric(email.body.priority))
current.priority = email.body.priority;
}

if (current.canWrite())
current.update();
}
*************************************************************************************************************
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]

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

Ankur Bawiskar
Tera Patron
Tera Patron

@vivek11 

it's simple.

2 ways

a) Actual testing

1) enable incoming email in your TEST instance and then send email to the instance email address

AnkurBawiskar_0-1755709220652.png

OR

b) test without enabling incoming email

1) You can also test by creating email record and provide all the required details.

2) Navigate to below path and click on New.

 

AnkurBawiskar_1-1755709337294.png

 

 

If my response helped please mark it correct and close the thread so that it benefits future readers.

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