Update Failed - When the Approve Request LINK opens in the Portal

Zig1
Kilo Expert

Hi,

We have a business requirement where the Approval Request LINK in the notification email should open up in the Portal,  and not the record in ServiceNow.

The script I use does open the portal on the Approval page, but when Approve or Reject is clicked, i get the error message: Update Failed (see screenshot)

The user receiving the Approval is not a fulfiller or have the approver role/license. Is anyone able to help point me in the right direction and if this can be fixed? Or will it never work because they don't have the fulfiller or approver license /role?

The mail script I use to open the portal from the Approval link is shown below.

Thanks for the help

find_real_file.png

 

(function runMailScript( /* GlideRecord */ current, /* TemplatePrinter */ template,
    /* Optional EmailOutbound */
    email, /* Optional GlideRecord */ email_action,
    /* Optional GlideRecord */
    event) {

    // Add your code here
	//Approval LINK from the email will go to the Portal (instead of to the record in SNOW)
	var url = 'Click here to view Approval Request: <a href="' + gs.getProperty('glide.servlet.uri') + 'snap?id=approval&table=sysapproval_approver' + '&sys_id=' + current.sys_id + '">LINK</a><br/>';
	template.print(url);

	//The RITM LINK from the email will go to the Portal (instead of to the record in SNOW)
	url = 'Click here to view Requested Item: <a href="' + gs.getProperty('glide.servlet.uri') + 'snap?id=form&table=sc_req_item&sys_id=' + current.sysapproval + '">LINK</a><br/>';
	template.print(url);
		

})(current, template, email, email_action, event);
2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

check this KB link which talks about same issue

unless user has approver_user role they cannot update the record

[Approval Info Widget] User is not able to approve a record from Service Portal after the upgrade to...

Resolution

Possible solutions in order for the functionality to work as it was before:

1) Provide the user with approval_admin or approver_user role.
2) Clone the Approval Info Widget, modify the Server Script code (same code as before the upgrade) and add it to the Portal page.

Regards
Ankur

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

Hey Ankur this seems helpful but I can not access the knowledge Articles shared,
Can you please share an extract or the key points from the KB for those of us who want to know more?
Thansk