- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 08:32 AM
Hello,
I am looking for a solution to add more information on sysapproval_approver table for the associated RITM record.
I have done it via database_view. But I also need to filter the view via the active user and the delegated approvals to her or him. The logic should work just as when you enter "Self-Service -> My Approvals" (you see that the page is already filtered for the active user and the delegated approvals).
Any idea how I can call this function?
Thank you!
Best,
Firat
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 06:35 AM - edited 10-10-2024 06:37 AM
Hi @Brad Bowman ,
Thanks a lot for your help.
Your code did not work for me but when I modified it a bit, it worked just fine:
(function executeRule(current, previous /*null when async*/) {
//gs.info('delegated one =' + new ApprovalDelegationUtil().getOnlyDelegatedApprovals());
gs.info('approvers =' + new ApprovalDelegationUtil().getApprovers());
// Get delegated approvals and approvers
//var delegatedApprovals = new ApprovalDelegationUtil().getOnlyDelegatedApprovals();
var approvers = new ApprovalDelegationUtil().getApprovers();
current.addQuery('app_approver', 'IN', approvers);
})(current, previous);
//gs.info('delegated one =' + new ApprovalDelegationUtil().getOnlyDelegatedApprovals());
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-01-2024 09:11 AM
You can further filter a Database View using a before Query Business Rule with the Database View Name as the Table. You need to prefix field names with the Variable prefix used in the view, so if you are using the sysapproval_approver table with a prefix of app, then the BR script to mirror the My Approvals view would be
(function executeRule(current, previous /*null when async*/) {
current.addEncodedQuery('app_sys_id=' + new ApprovalDelegationUtil().getOnlyDelegatedApprovals() + '^ORapp_approver=' + new ApprovalDelegationUtil().getApprovers());
})(current, previous);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-10-2024 06:35 AM - edited 10-10-2024 06:37 AM
Hi @Brad Bowman ,
Thanks a lot for your help.
Your code did not work for me but when I modified it a bit, it worked just fine:
(function executeRule(current, previous /*null when async*/) {
//gs.info('delegated one =' + new ApprovalDelegationUtil().getOnlyDelegatedApprovals());
gs.info('approvers =' + new ApprovalDelegationUtil().getApprovers());
// Get delegated approvals and approvers
//var delegatedApprovals = new ApprovalDelegationUtil().getOnlyDelegatedApprovals();
var approvers = new ApprovalDelegationUtil().getApprovers();
current.addQuery('app_approver', 'IN', approvers);
})(current, previous);
//gs.info('delegated one =' + new ApprovalDelegationUtil().getOnlyDelegatedApprovals());