Where is my isApprovalMine()??
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2009 12:51 AM
I've a function called isApprovalMine() which I want to debug. This function is used in an UI Actions' condition field as below:-
(current.approval == 'requested' || current.approval == 'rejected' || current.approval == 'open' || current.approval == 'pending') && (gs.hasRole('admin') || gs.hasRole('approval_admin') || isApprovalMine(current))
The problem is I am not sure where the function is hiding. 😞
I've searched thru the Script Include, Client Script, Validation Script and Business Rules and even enable Debug All but still no clue where is it.
Hope anybody read this post can help me on this :).
Thanks.
- Labels:
-
Discovery
-
Service Mapping
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-03-2009 11:50 AM
It's in a global business rule called 'getMyApprovals'.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-04-2009 12:05 AM
Thanks. I found it finally :).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-25-2015 07:27 AM
I am looking for a similar function as "isApprovalMine()".
But instead of getting personal approvals from a user I would like to collect group approvals from a certain user.
Any ideas?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-17-2019 04:02 AM
I am not fully sure, but it seems that isApprovalMine() is not able to correctly handle records with several approval steps, like Change Request. In my case UI Action Approve Change is shown also for the user, who is not a member of the group, which is currently requested for approval, if the user is asked for approval in earlier steps. Here is my solution, HTH 🙂
UI Action: Approve Change
Condition:
isApprover(current) && current.type=='normal'&&(current.state=='-4'||current.state=='-3')
Script:
function approveChg() {
var gr = new GlideRecord('sysapproval_approver');
gr.addQuery('state', 'requested');
gr.addQuery('sysapproval', current.sys_id);
gr.query();
while (gr.next()) {
if (isApprovalMine(gr)) {
gr.setValue('state', 'approved');
gr.update();
}
}
action.setRedirectURL(current);
}
approveChg();
Business Rule: XGetMyApprovals
function isApprover(rc) {
var gr = new GlideRecord('sysapproval_approver');
gr.addActiveQuery();
gr.addQuery('approver', gs.getUserID());
gr.addQuery('document_id', rc.sys_id);
gr.addQuery('state', 'requested');
gr.addQuery('sysapproval', rc.sys_id);
gr.query();
if (gr.next()){
//gs.warn(gr.document_id);
return true;
}
else {
return false;
}
}