How to filter on Approval Group in sysapproval_approver table?

Paul125
Kilo Guru

Hello, I have tried below queries but nothing seems to work. Please someone suggest me the right one. Thanks

var approvals = new GlideRecord("sysapproval_approver");
	approvals.addQuery('sysapproval', current.sys_id);
	approvals.addQuery('assignment_group', 'de7c36dedb90a3c838a5cae3b99619b4');
//also tried
       approvals.addQuery('sysapproval_group', 'de7c36dedb90a3c838a5cae3b99619b4');
1 ACCEPTED SOLUTION

It looks like only individuals are put into the sysapproval_approver table and it does not seem to reference what group the are a member of directly.  It looks like you would need to search sysapproval_group and get the sys_id from there of what you are looking for approvals on so you can then search for the members of that group who have rejected the request in the sysapproval_approver table.  Note it only looks like the table sysapproval_group table gets populated if the workflow activity of Approval - Group is used to set the approvers.  The group in the sysapproval_approver table seems to be a reference to which group was set as the approver in the sysapproval_group table.  Hopefully this was not to confusing as I confused myself was I was looking at the two table and testing what populated each from the workflow.

View solution in original post

13 REPLIES 13

Then you should be using the group approval table then... which is sysapproval_group.

Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

It looks like only individuals are put into the sysapproval_approver table and it does not seem to reference what group the are a member of directly.  It looks like you would need to search sysapproval_group and get the sys_id from there of what you are looking for approvals on so you can then search for the members of that group who have rejected the request in the sysapproval_approver table.  Note it only looks like the table sysapproval_group table gets populated if the workflow activity of Approval - Group is used to set the approvers.  The group in the sysapproval_approver table seems to be a reference to which group was set as the approver in the sysapproval_group table.  Hopefully this was not to confusing as I confused myself was I was looking at the two table and testing what populated each from the workflow.

Thanks a lot for the reply Brain. This is really looks confusing to me. Can we make this simple by using addEncodedQuery by any chance? Thanks!

I don't think so as it is crossing two tables.  I think you need to query the sysapproval_group table to find the reference for the group field in the sysapproval_approver and then you can query the reference to see if there are any rejections by members of that group.

Sorry Paul, I was thinking on this and you could do a encoded query buy dot walking to the other table since it in a reference in the sysapproval_approver table.  You may need to click on show related fields.  It should look something like this.

find_real_file.png