KB Approval Issue

Palak5
Tera Contributor

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. 

 

1 ACCEPTED SOLUTION

piyushsain
Tera Guru
Tera Guru

Hi,

In the push you should convert it to string. Try ;

answer.push(approvers.user.toString());

 

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,
Piyush Sain

View solution in original post

6 REPLIES 6

Both the logics worked with ".toString()"!!!

Thanks 🙂

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.