Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Allow end user to see the current approver

major li
Tera Expert

Hi Community,

Greetings. 

I have received a requirement to allow end user to see who is the current/next approves in the widget. Is there a way of doing it?

Currently we are also planning for an upgrade, from Xanadu to Zurich. Is there such a feature OOTB?

Thank you all.  

11 REPLIES 11

Ankur Bawiskar
Tera Patron
Tera Patron

@major li 

nothing available OOTB.

You will have to do some customization for this which I won't recommend.

Please inform customer about the technical debt when customization is involved.

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

kaushal_snow
Giga Sage

@major li ,

 

As Ankur said, I won't recommend you to customize oob widget but, if you have requirement, you can clone the existing widget and modify its Server Script to include the desired approver information. For instance, you can adjust the data.showApprovals property to ensure the widget is visible to all users, not just those with specific roles. Additionally, you can enhance the widget's functionality by incorporating the Approval Info widget, which provides detailed information about the approval request, including the current approver....

 

If you found my response helpful, please mark it as ‘Accept as Solution’ and ‘Helpful’. This helps other community members find the right answer more easily and supports the community.

 

Thanks and Regards,
Kaushal Kumar Jha - ServiceNow Consultant - Lets connect on Linkedin: https://www.linkedin.com/in/kaushalkrjha/

Nawal Singh
Tera Guru

Hi @major li ,

It not available in OOB but if you want to customize, you can clone that widget and configure like -

 

Server script-

 

(function() {
    // Get the sys_id of the task from input or URL parameter
    var taskSysId = input.taskSysId || $sp.getParameter("sys_id");
    data.approvers = [];

    if (taskSysId) {
        var gr = new GlideRecord('sysapproval_approver');
        gr.addQuery('sysapproval', taskSysId);
        gr.addQuery('state', 'requested'); // Only pending approvers
        gr.orderBy('sys_created_on'); // Oldest first = likely current/next
        gr.query();

        while (gr.next()) {
            data.approvers.push({
                name: gr.approver.getDisplayValue(),
                email: gr.approver.email + '',
                state: gr.state.getDisplayValue(),
                created: gr.sys_created_on.getDisplayValue()
            });
        }
    } else {
        data.error = "No task sys_id provided.";
    }
})();

 

HTML like this- 

 

<div>
  <h4>Pending Approvers</h4>

  <div ng-if="data.error">
    <p class="text-danger">{{data.error}}</p>
  </div>

  <div ng-if="!data.error && data.approvers.length === 0">
    <p>No pending approvers found.</p>
  </div>

  <table class="table table-striped" ng-if="data.approvers.length > 0">
    <thead>
      <tr>
        <th>Name</th>
        <th>Email</th>
        <th>State</th>
        <th>Requested On</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="approver in data.approvers">
        <td>{{approver.name}}</td>
        <td>{{approver.email}}</td>
        <td>{{approver.state}}</td>
        <td>{{approver.created}}</td>
      </tr>
    </tbody>
  </table>
</div>

 

If you found my response helpful, please mark it as helpful and accept it as the solution.

Thank you
Nawal Singh

Mark Manders
Mega Patron

Besides the technical debt, you need to realize that this can be highly annoying for the approvers. They will get messages, asking to approve, because people know who is supposed to approve. 
Next to that, you can also run into access issues (depending on the modules you have). Not all end users have access to all names in the user table.
This is one of those requirements that should be challenged by the requester. What is the issue they think they are going to resolve and do they realize the consequences? 


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark