How to show approval/rejection comments in portal

vivek11
Tera Contributor

vivek11_0-1755675836601.png

How to show approval/rejection comments in portal when user approves/ rejects in portal through widget as shown. Currently comments are visible only if user approves through backend

7 REPLIES 7

@kaushal_snow 

The question is not about showing activity log but about rejection comments.

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

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @vivek11 

 

If I’m not wrong, in the ESC portal this is out-of-the-box — whenever any request gets rejected.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

Gaurav Vaze
Kilo Sage

Hello @vivek11 
although this might be an customization, but I had the same requirements.
Point to note is where your approval rejection comments are being copied.
In my knowledge, if anything is added as additional comment, then the end user is able to see that entry on the portal.
So I my solution for this was
1] Create a after update BR on  sysapproval_approver table. 
2] Add condition as state changes(as per your requirement, mine was for rejection)
3] now in the code, copy the approval comments into the associated RITM's additional comments

example code

//my case was to handle rejection, you can customize as per need
if(current.state=='rejected'){
    var gr = new GlideRecord('sc_req_item');
    gr.addQuery('sys_id',current.document_id);
    gr.query();
    if (gr.next()) {
        var comments = current.comments.getJournalEntry(-1);
        if (gr.get(current.document_id)) {
            gr.comments = comments;
            gr.update();
        }
    }

This way you can have the approval/rejection comments to be displayed to the end user

Mark my answer as helpful if it directed you towards solution.

If this resolved your question then mark Accept as Solution

happy to help
Thank you!

Gaurav Vaze

ServiceNow Developer