Approving a request using inbound email action

Community Alums
Not applicable

I want to approve a request using an inbound email action.

Below mentioned is my inbound action script:

Script:

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

// // Implement email action here
var arr=email.subject.split(" ")
var req_item=arr[0];


current.addQuery('sysapproval',req_item)

current.query()
while(current.next()){
current.state="approved"


}
current.update()

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

 

find_real_file.png

I For example, i am trying to approve the below mentioned record in sysapproval_approval table.

find_real_file.png

Below mentioned is the email template.find_real_file.png

If there is any alternative and easiest way to approve any request item using inbound email action, please suggest the same.

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

This is already happening OOB

I didn't get why new inbound action is created

Regards
Ankur

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

Community Alums
Not applicable

Hi Ankur,

It's not working for me. 

Thanks