- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 12:56 AM
Hi All,
I am trying to attach approvals to the knowledge article through the script of the "Approval User" workflow activity.
The requirement is: Approval should go to the common users of the current ownership group and another specific group.
The logs show the correct output, but the approval is just added once for a random user from the ownership group but that user is not a member of the second group.
answer = [];
var assignmentGroup = current.u_ownership_group.name;
gs.info("Assignment group is - " + assignmentGroup);
var approvers = new GlideRecord("sys_user_grmember");
approvers.addQuery('group.name', assignmentGroup);
approvers.query();
gs.info("Total members - " + approvers.getRowCount());
while (approvers.next()) {
gs.info("User tested - " + approvers.user.name);
var gr = new GlideRecord('sys_user_grmember'); //
gr.addQuery('user', approvers.user);
gr.addQuery('group', "sys_id_of_another_group");
gr.query();
if (gr.next()) {
var user = approvers.user;
gs.info("User is Member of Group!" + approvers.user.name);
answer.push(user);
}
}
Unable to find the issue here.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 03:54 AM - edited ‎01-10-2024 03:56 AM
Hi,
In the push you should convert it to string. Try ;
answer.push(approvers.user.toString());
Regards,
Piyush Sain
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 04:09 AM
Both the logics worked with ".toString()"!!!
Thanks 🙂
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2024 04:40 AM
Hi @Palak5
Please mark my answer as helpful and correct if it helped you.
Thanks & Regards
Amit Verma
Please mark this response as correct and helpful if it assisted you with your question.