The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Neen to write the inbound email for Rejeact the approval

PRAGHATIESH S
Tera Expert

I created one problem task that will be assigned to service manager. After that will tigger the approval and rejection email. If it rejected, again that problem task will trigger the email to problem assigned to. Can any one help me corecting the bewlo code. 

I created inbound email action on problem_task table.

(function runAction( /*GlideRecord*/ current, /*GlideRecord*/ event, /*EmailWrapper*/ email, /*ScopedEmailLogger*/ logger, /*EmailClassifier*/ classifier) {

    // Implement email action here
    if (current.state == '151') // new state
    {
        if (email.subject.indexOf("approve") >= 0) {
            current.state = '157'; // complete state
            current.close_notes = 'As a service owner, I approve this request';
            current.close_code = 'completed'; //approve
            current.due_date = gs.nowDateTime();
            current.update();
        } else if (email.subject.indexOf("reject") >= 0) {

           
        }
    }

})(current, event, email, logger, classifier);
1 ACCEPTED SOLUTION

Sarika S Nair1
Kilo Sage

Hi @PRAGHATIESH S  

1.Go to event registry and create a new event.

2.Then create one Notification with When to send as event fired and choose the event which you created 

3.Trigger it using gs.eventQueue('eventname',current,parm1,parm2);  in your else if condition

 

SarikaSNair1_0-1707722621475.png

 

 

View solution in original post

1 REPLY 1

Sarika S Nair1
Kilo Sage

Hi @PRAGHATIESH S  

1.Go to event registry and create a new event.

2.Then create one Notification with When to send as event fired and choose the event which you created 

3.Trigger it using gs.eventQueue('eventname',current,parm1,parm2);  in your else if condition

 

SarikaSNair1_0-1707722621475.png