Inbound email replys

Nataliia_Lova
Tera Guru
Hello, Community,
I'm working on inbound actions. Where users reply to the notification, this response has to update the record in the "Additional comments" field. What should I type into the Script?
Screenshot 2024-01-12 at 16.46.16.png
1 ACCEPTED SOLUTION

Aniket Chavan
Tera Sage
Tera Sage

Hello @Nataliia_Lova ,

You can try with the script below and let me know how it works for you.

(function runAction(/*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {
    if (current.getTableName() == "x_1111599_finance_request" && email.subject.indexOf("request Fin") !== -1) {
        current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
        current.update();
    }
})(current, event, email, logger, classifier);

 

Let me know your views on this and Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks,

Aniket

View solution in original post

7 REPLIES 7

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Nataliia_Lova 

 

Have a look here

https://www.servicenow.com/community/developer-forum/update-additional-comments-field-with-user-mail...

https://www.servicenow.com/community/csm-forum/additional-comments-by-inbound-action/td-p/2438461

 

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

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

SunilKumar_P
Giga Sage

Hi @Nataliia_Lova, Can you try the below?

current.comments = "reply from: " + email.origemail + "\n\n" + email.body_text;
current.update();

 

Regards,

Sunil

 

 

How can I check if it works?

You need to respond to an email sent from ServiceNow (Sent when record is updated or created etc) and that should contain the watermark in it. Also, you need to make sure you match the condition defined in the inbound email action (Subject contians request Fin).