Group Approval - Based on members employment type
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hi All,
We have a requirement that there should be a group approval triggered to the CI Business Service group's only permanent employee. Like the if the group has 5 members and 3 out of them are contractors it should be any one approve for the rest two permanent employee.
Thanks
Ritik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Try this
Flow Designer Approach
Instead of a group approval activity, use a Script Step to create filtered approvals, then an Wait for Condition or Approval activity:
// Script Step: Create approvals for permanent employees only
(function execute(inputs, outputs) {
var members = new GlideRecord('sys_user_grmember');
members.addQuery('group', inputs.group_sys_id);
members.query();
while (members.next()) {
var user = members.user.getRefRecord();
if (user.getValue('employee_type') != 'contractor') {
var appr = new GlideRecord('sysapproval_approver');
appr.initialize();
appr.setValue('sysapproval', inputs.record_sys_id);
appr.setValue('approver', user.getUniqueValue());
appr.setValue('state', 'requested');
appr.setValue('source_table', inputs.table_name);
appr.insert();
}
}
})(inputs, outputs);
Then add a Wait for Condition step:
Table:
sysapproval_approver→ wheresysapproval = record_sys_idANDstate = approved→ exists
Once any one approves, the flow continues and you run a second script step to set remaining approvals to not_required.
Adjust employee_type != 'contractor' to match whatever field your instance uses to flag contractors (could be a custom field like u_is_contractor or an HR profile attribute).
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
you can use scripted approval in flow and grab only those 3 members i.e. permanent
Scripted Approvals in Flow Designer with Flow Variables
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 weeks ago
Hope you are doing good.
Did my reply answer your question?
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
