Script include to get the list of assignment group

Sandy42
Tera Expert

Hi,

Need help on the script include to get list of assignment group for project task form.

I need to filter the assignment group of Project task form to contain group type (support, Agile Team) OR group has role = pss_resource

Currently, there is OOB script include in dictionary override for Project task. I need to write a custom script include and give a reference to out of box script include.

4 REPLIES 4

Vaishnavi Lathk
Mega Sage
Mega Sage

Hello,

Try that code

var GetCurrentUserGroups = Class.create();
GetCurrentUserGroups.prototype = Object.extendsObject(AbstractAjaxProcessor, {
initialize:function() {
},
BackfillAssignmentGroup:function() {
var gp = ' ';
var a = gs.getUserID(); // returns sysID of user responded

//sys_user_grmember has the user to group relationship
var grp = new GlideRecord('sys_user_grmember');
grp.addQuery('user',a);
grp.query();
while(grp.next()) {
if (gp.length > 0) {
gs.log("query ran");
//build a comma separated string of groups if there is more than one
gp += (',' + grp.group);
}
else {
gp = grp.group;
}
}
gs.log('gp');
// return Groups where assigned to is in those groups we use IN for lists
return 'sys_idIN' + gp;
},
type: 'GetCurrentUserGroups'
});

Hi Vaishnavi,

Thank you for the response.

Irrespective of logged in user i need the filter to be applied for assignment group, we can get it done by adding encoded query in reference qualifier, but my manager wants it to be done thru script include.

Currently the OOB dictionary override for pm_project_task is javascript:ScrumSecurityManager.getPhaseDotGroup(current, 'assignment_group')

My manager wants me to create a custom script include with the filter group type (support, Agile Team) OR group has role = pss_resource and give a reference to out of box script include.

Please assist me on this.

Thank you.

Tejas Tamboli
Giga Guru

Hi Sandy,

Can you try with the below code?

If no, Please refer below code do changes accordingly:

function GetGroupsList(){
     var id=[];
     var gr= new GlideRecord('sys_user_grmember');
     gr.addEncodedQuery('group_type=support^group_type1=Agile Team^ORgroup.roles=pss_resource');
     gr.query();

     while(gr.next()){
        id.push(gr.getValue("group"));
     }
     return "sys_idIN"+id.join();
}

Let me know if you are getting the expected output...

 

I hope this will help you.


Mark  Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.

Thanks & Regards,
Tejas Tamboli

Hi Tejas,

Thank you, but no luck here. above code is not working.