Requested Item should go to assignment group manager for approval and then generate the catalog task

Abhijeet Anand
Tera Contributor

Hello All,

Can anyone help me to review the simple code that i have written to fetch the assignment group manager to approve the requested item and then it should generate the catalog task?

I am using Approval User activity and have written below code.

var gr = new GlideRecord('sys_user_group');
gr.addQuery('sys_id', current.variables.assignment_group);
gr.query();
if (gr.next()) {
var name = gr.manger.toString();
gs.log("please find the name of the manger" + name);
answer.push(name);
}

Tried using via attached configurable way as well but it is still not working and approval user activity seems to be skipped and it generates the catalog task.

I have checked and the manager field is populated in the sys_user_group form.

Thanks

1 ACCEPTED SOLUTION

Hi Abhijeet,

 

Since I answered your initial query successfully. I request you to mark my above response as correct. As far as your new code is concerned it should be as below

var gr = new GlideRecord('sys_user_grmember');

gr.initialize();
gr.group = current.variables.assignment_group;
gr.user = current.variables.requested_for;
gr.insert();
gs.log("User " + current.variables.requested_for + " has been added to group " + current.variables.assignment_group);

View solution in original post

8 REPLIES 8

I don't think I have kept those two line:

gr.addQuery('group',current.variables.assignment_group);
gr.query();
if(gr.next()){

 

Please copy my code as it is and paste

Best Regards
Aman Kumar

Thank you for your response. my issue is resolved.

Hi Abhijeet,

 

Since I answered your initial query successfully. I request you to mark my above response as correct. As far as your new code is concerned it should be as below

var gr = new GlideRecord('sys_user_grmember');

gr.initialize();
gr.group = current.variables.assignment_group;
gr.user = current.variables.requested_for;
gr.insert();
gs.log("User " + current.variables.requested_for + " has been added to group " + current.variables.assignment_group);

Thank you for your help. Issue is resolved