GlideRecord in sysapproval_group

amlanpal
Kilo Sage

Hi all,

I need a requirement like this. I'm in at Group Approval (sysapproval_group) table. We all know in the related list 'Approvals', all the group members or approvers are present.

Now I need to know after query that whether the Logged in user is the one of the Approvers present in that list. For the information, in the Group Approval table the group is dynamically selected, so I'm not able to do query with a static sys_id of any particular group.

Any help will be highly appreciated!

3 REPLIES 3

sumeet_n
Kilo Guru

Why dont you directly query sysapproval_approver table with all the logged in users?


Chuck Tomasi
Tera Patron

How about this (a script of what Sumeet said)



var current = new GlideRecord('sysapproval_group');


current.get('b706a2f1134b12003c4ebdb12244b0a7');



// Check to see if the logged in user is in the approvers group of the current group approval



var isMember = false;


var app = new GlideRecord('sysapproval_approver');


app.addQuery('group', current.sys_id);


app.addQuery('approver', gs.getUserID());


app.setLimit(1);


app.query();



if (app.hasNext())


  isMember = true;



gs.info('Current user is a member of this group: ' + isMember);


amlanpal
Kilo Sage

Thanks folks, for your prompt reply!   I am able to do that by querying in the sysapproval_approver table at last. Thanks again!