Email reply should update the "sc_task" state

bhaavani
Tera Contributor

Hi experts,

 

I have a requirement where when an "sc_task" is created then I am triggering an email notification to custom DL "greendoor@cba.com" which is not there in servicenow. The notification body will have "Please Onboard the user". Then when "greendoor@cba.com" will reply "The user is created and added to the Global group". This will be their reply no other number or nothing on the email body when they reply. Now based on this I need to change the "sc_task" state to "Work in Progress".  I created an Inbound action, but it didn't work then I created a flow using the trigger option as inbound and this is also not working. Can someone please help here ? Below are the screenshots:

 

Inbound action:

 

bhaavani_0-1768922051911.png

bhaavani_2-1768922087214.png

 

Thanks in advance

 

1 REPLY 1

vaishali231
Giga Guru

Hey @bhaavani 

Inbound Email Action setup

Target table: sc_task

Type: Reply

Active: true

Order: 100

Script :

(function runAction(current, event, email, logger, classifier) {

    if (!current || !current.sys_id)
        return;

    var bodyText = email.body_text || "";
    bodyText = bodyText.toLowerCase().trim();

    if (bodyText == "the user is created and added to the global group") {
        current.state = 2; // Work in Progress
        current.work_notes = "Confirmation received from greendoor DL via email reply.";
        current.update();
    }

})(current, event, email, logger, classifier);

*********************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.

Regards
Vaishali Singh