- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 02:34 AM
Hi,
If I assign a delegate to an approver, Can I show delegate in Approvers tab in change request?
I made Fred luddy as delegate for Abel tuter.
In approvers tab, it shows only abel tuter, I need to show his delegate Fred luddy too.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 03:24 AM
You can pull that off using Hierarchical lists.
First, create a Relationship on the Approvals table that shows all the Delegates for the Approver.
Relationships are how you create your own custom Related Lists.
Add the Relationship to the Approval table via Configure > Related Lists.
Now go to the table where your Approvals Related List is - the Change Request table or whatever.
On the Approvals Related List, go to Configure > List Control and check Hierarchical lists.
You will see new arrows on each Row. Expand the arrows. The Hierarchical lists show all the Related Lists for that record - which is your new Delegates List.
I personally think it looks ugly - but there is nothing you can do about that.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 02:52 AM
There can be multiple Delegates for one person. There is no out-of-the-box way to do what you need. So you need to create a new field and populate it.
To do this I would create a new User List field on the Approvals table (sysapproval_approver) called u_delegates, and populate it with a before insert Business Rule.
(function executeRule(current, previous /*null when async*/) {
// Look for Delgates
var userIDs = [];
var del = new GlideRecord('sys_user_delegate');
del.addQuery('user', current.approver);
del.addQuery('approvals', true);
del.addQuery('starts', '<=', gs.nowDateTime);
del.addQuery('ends', '>=', gs.nowDateTime);
del.query();
while (del.next()) {
userIDs.push(String(del.delegate));
}
current.u_delegates = userIDs.join();
})(current, previous);
Then you can add your Delegates field to the List View of your Approvals table.
You might want to put a similar Business Rule on the Delegates table to update existing Approvals when a new Delegate is created after the Approval is Requested.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 03:00 AM
Hi Geoffrey Sage,
Thanks for the response!
I want to show delegate as a record along with the actual approver but not as a field/column .
Ex:In the above screenshot, It should show fred luddy along with abel tuter (2 records) in approver tab.
When the delegate time interval gets finish, then the record of delegate should not get visible in approver tab.This is my actual requirement

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 03:24 AM
You can pull that off using Hierarchical lists.
First, create a Relationship on the Approvals table that shows all the Delegates for the Approver.
Relationships are how you create your own custom Related Lists.
Add the Relationship to the Approval table via Configure > Related Lists.
Now go to the table where your Approvals Related List is - the Change Request table or whatever.
On the Approvals Related List, go to Configure > List Control and check Hierarchical lists.
You will see new arrows on each Row. Expand the arrows. The Hierarchical lists show all the Related Lists for that record - which is your new Delegates List.
I personally think it looks ugly - but there is nothing you can do about that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-07-2016 05:44 AM
Hi Geoffrey Sage,
Thank you, I tried as you said, it worked.
It looks really weird, but anyway achieved the functionality.
Many thanks to you!!