I need to populate assigned to based on assignment group.

niveditakumari
Mega Sage

Hi, 

 

I need to populate assigned to based on assignment group. I have written this code and it is not working. 

niveditakumari_0-1707422000437.png 

niveditakumari_1-1707422097971.png

 

 

Please correct my code to make it work. 

 

Regards, 

Nivedita 

 

 

 

1 ACCEPTED SOLUTION

Rohini S Sane
Tera Guru

Hi @niveditakumari 

You can write below code in script include, its working on my PDI.

Script include code :

var populate_ag = Class.create();
populate_ag.prototype = {
    initialize: function() {
    },
myFunction : function(aggroup)
{
    var arr = [];
    var gr = new GlideRecord('sys_user_grmember');
    gr.addQuery('group',aggroup);
    gr.query();
    while(gr.next())
    {
arr.push(gr.user.toString());
    }
    return 'sys_idIN' + arr;
},
    type: 'populate_ag'
};
 
advanced ref qualifier script : javascript:new populate_ag().myFunction(current.u_group);
 
result.pngscriptinclude.pngadvref.png
 
Please mark helpful .
 
Thanks and Regards,
Rohini S Sane

View solution in original post

17 REPLIES 17

James Chun
Kilo Patron

Hi @niveditakumari ,

 

Try changing the 'Reference' field of the 'Assigned to' variable to the User [sys_user] table, not the Group Member table.

 

Thanks!

HI @James Chun

 

Thank you for correcting me. 

I have corrected that it is showing all users in assigned to field after selecting any group in assignment group field. 

 

Regards, 

Nivedita 

shyamkumar VK
Kilo Patron

@niveditakumari , Code looks Fine but under the Assigned to Reference it should be sys_user not the group member table , can you please correct that and give a try

 

Regards,

Shyamkumar 

 

Please mark this as helpful and accept as a solution if this resolves your Ask.
Regards,

Shyamkumar

Hi @shyamkumar VK,

 

Thank you for correcting me. 

I have corrected that it is showing all users in assigned to field after selecting any group in assignment group field. 

 

Regards, 

Nivedita