Approval Reject from Email Not Updating RITM – Inbound Action Active but Not Working

tilekarnilesh
Giga Guru

Hello Community,

I've created Approve and Reject buttons in a notification email for RITM (Requested Item) approvals in my ServiceNow Developer Instance. The buttons are successfully sending the email and triggering a response, but the RITM is not getting updated (i.e., not moving to Approved/Rejected state).

 

The inbound action named "Update Approval Request" is active.

Despite this, the approval state on the RITM is not changing after the user clicks Approve or Reject.

I’ll attach the following for reference:

Screenshots of the mail buttons

A link to the community post where I referenced this button creation method - https://www.servicenow.com/community/itsm-blog/approve-reject-button-in-approval-notification/ba-p/2...

Has anyone faced a similar issue or could guide me on what else to verify?

Thanks in advance!

tilekarnilesh_0-1750323923271.png

tilekarnilesh_1-1750324355052.png

 


@Chaitanya ILCR @Ankur Bawiskar

6 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@tilekarnilesh 

when you receive the email, in related list you see which all inbound email actions were processed and skipped.

Did you check that?

If that's an OOTB inbound email action then ideally no one must have updated it.

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

View solution in original post

@tilekarnilesh 

unless email comes to instance inbound email action won't be processed

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

View solution in original post

@tilekarnilesh Are you sure that you're sending a reply email?
You need to hit send button

JSiva_0-1750327016813.png

Also, check whether the 'Email Receiving' property is enabled in your instance

JSiva_1-1750327151168.pngJSiva_2-1750327170585.png

 

View solution in original post

@tilekarnilesh 

email sending is disabled and hence email not coming to instance.

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

View solution in original post

@tilekarnilesh Are you sending the reply email from your outlook?

View solution in original post

31 REPLIES 31

@J Siva  There may be an issue with the dev instance, need to contact ServiceNow for this.
Thanks once again..😊

daichiTrojan
Tera Contributor

Hi,

The first step is to verify if the inbound action is being triggered. You can do this by adding some logs to check if it is running. Simply activating it doesn't guarantee that it is working. Once you confirm that the inbound action is being triggered, we can then review the logic within it. Could you also provide a screenshot of the inbound action after confirming it is triggered by each inbound email?

@daichiTrojan 

/*global current, email, gs, GlideController, GlideRecord*/
/*eslint-disable eqeqeq*/
processApprovalEmail();

function processApprovalEmail() {
    "use strict";
    var errorMsg = "";
    var msgArray = [];

    if (current.getTableName() != "sysapproval_approver")
        return;

    var displayValue = getApprovalDisplayValue(current);

    if (!validUser()) {
        gs.log(getFailurePreamble() + "Sender email does not match approval assignee.");
        msgArray.push(displayValue);
        msgArray.push(current.approver.getDisplayValue());
        msgArray.push(current.approver.email);
        errorMsg = gs.getMessage("approvalInvalidUser", msgArray);
        createEmailEvent(errorMsg);
        return;
    }

    if (current.state == 'cancelled') {
        gs.log(getFailurePreamble() + "The approval has been canceled.");
        msgArray.push(displayValue);
        errorMsg = gs.getMessage("approvalCancelled", msgArray);
        createEmailEvent(errorMsg);
        return;
    }

    //Added for 'No Longer Required' approval state
    if (current.state == 'not_required') {
        gs.log(getFailurePreamble() + "The approval is no longer required.");
        msgArray.push(displayValue);
        errorMsg = gs.getMessage("approvalNotRequired", msgArray);
        createEmailEvent(errorMsg);
        return;
    }

    if (email.body.state != undefined)
        current.state = email.body.state;

    if (email.subject.indexOf("approve") >= 0)
        current.state = "approved";

    if (email.subject.indexOf("reject") >= 0)
        current.state = "rejected";

    if (current.state != "approved" && current.state != "rejected") {
        gs.log(getFailurePreamble() + "The subject is malformed. The approver probably did not click the approve or reject button on the email.");
        msgArray.push(displayValue);
        errorMsg = gs.getMessage("approvalFailed", msgArray);
        createEmailEvent(errorMsg);
        return;
    }

    current.comments = "reply from: " + email.from + "\n\n" + email.body_text;
    var controller = new GlideController();
    controller.putGlobal("approvalSource", "email");
    current.update();
    controller.removeGlobal("approvalSource");

    function validUser() {
        return new ApprovalDelegationUtil().isMyApproval(current);
    }

    function createEmailEvent(msg) {
        gs.eventQueue("approval.email.errorMsg", current, email.from, msg);
    }

    function getFailurePreamble() {
        return 'Approval email from ' + email.from + ' for task "' + displayValue + '" assigned to "' + current.approver.getDisplayValue()
                + '" failed because: ';
    }

    function getApprovalDisplayValue(approval) {
        if (!gs.nil(approval.sysapproval))
            return approval.getDisplayValue();
        else {
            var target = new GlideRecord(approval.source_table);
            if (target.get(approval.document_id))
                return target.getDisplayValue();
        }
        gs.warn("Target for sysapproval_approver:" + approval.getUniqueValue() + " not found. Target=" + approval.source_table + ":" + approval.document_id);
        return "Unknown";
    }

}

Ankur Bawiskar
Tera Patron
Tera Patron

@tilekarnilesh 

when you receive the email, in related list you see which all inbound email actions were processed and skipped.

Did you check that?

If that's an OOTB inbound email action then ideally no one must have updated it.

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