Approvals are not set to "No longer required"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi All,
I have a requirement that when group approval is triggered for a request, and if any new members added to that group, then that users should also see the approval record.
I have created a after BR on sys_user_grmember table, currently when request is created and group approval triggered and afterwards when i add new users to that group, the users could see the approval record. the issue is when the request is approved by anyone of the group member, other approval records are moved to "no longer required", but newly inserted approvals on sysapproval_approver are not moved to "no longer required", still is in "requested" state.
Any help would be appreciated. Thank you.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
If you have a (legacy) workflow with an Approval - Group activity, you'll need to put that within an Approval Coordinator activity to also handle the manual approvals that you are creating with the BR. I'm not sure if there's an equivalent action necessary for Flow Designer/Workflow Studio. Also take a look at the createUserApprovals function in the WorkflowApprovalUtils Script Include that the out of box Business Rule calls when a group approval is created to create the user approvals. Maybe one of these other fields on the approval record that's created is needed by the BR that is updating the State of the others.
var ids = this.getMembersOfGroup(groupApproval.assignment_group);
var state = groupApproval.approval + '';
var taskId = groupApproval.parent + '';
var approvalId = groupApproval.sys_id + '';
for (var i = 0; i < ids.length; i++) {
var approval = new GlideRecord('sysapproval_approver');
approval.initialize();
approval.sysapproval = taskId;
// fill out reference to task with the in-memory GlideRecord.
// When "Approval Events (Task)" runs it will be able to obtain the task type even though it doesn't yet exist in DB
var target = groupApproval.parent.getRefRecord();
approval.sysapproval.setRefRecord(target);
approval.source_table = target.getRecordClassName();
approval.document_id = target.sys_id +'';
approval.group = approvalId;
approval.approver = ids[i];
approval.wf_activity = groupApproval.wf_activity;
approval.state = state;
if (state == 'approved')
approval.setValue('comments', gs.getMessage('Automatic approval'));
approval.expected_start = groupApproval.expected_start;
approval.due_date = groupApproval.due_date;
approval.insert();
}