Set Reference qualifier to only show assignment group parent for certain roles

Andrew112
Kilo Guru

I have a request from my manager to get the assignment group for incident to only show the assignment group's parent assignment group for certain roles.

I have a script include:

function myGroupFilter() {

        if (gr.userHasRole('itil_limited'))
            return 'assignment_group=' + current.assignment_group.parent;
	
	
        if (gr.userHasRole('itil'))
            return;


}

 

But obviously this is not working.. help please. (also do i make the script include client callable or not)

 

1 ACCEPTED SOLUTION

ccajohnson
Kilo Sage

When you are building a reference qualifier, you are actually filtering the list based upon the fields in the referenced table. From what I can see you are using 'assignment_group=' + current.assignment_group.parent

Since the Assignment group [assignment_group] field does not exist in the Group table, your reference qualifier will fail. See if you can create the filter you desire on the Group table first to see if you can build the filter from fields that exist in the table you are referencing.

You may want to consider only showing those groups which are parents and do not have parents of their own. I can see where a user picks a parent assignment group, then cannot pick anything else after that (even itself).

Something else to consider is what happens when the vendor decides to clear the assignment group field. There is nothing for your reference qualifier to get the parent of, so it will fail here too.

View solution in original post

7 REPLIES 7

Ashutosh Munot1
Kilo Patron
Kilo Patron

Hi,


Where you want to show this? In same assignment group field?

 

Thanks,
Ashutosh

Yes... but in the options to select another assignment group.  (I dont want the user to be able to select everything but only the parent)

Harish Vaibhare
Kilo Guru

Hi,

Could you please elaborate more?

Where the logged in user can see assignment goup's parent group ?

Andrew112
Kilo Guru

OK So let me explain simply.  We have a vendor.  The vendor only needs to be able to change the incident assignment group to the current assignment group's parent. (Example: if the current assignment group is "Network" they can only change it to parent of "Network" which is "IT".  I achieved this with a UI action and client script based on role to set the assignment group field to read only and here is the UI action:

function VendorEscalate(){
    var obj = g_form.getReference('assignment_group').parent;
    g_form.setValue('assignment_group', obj);
    g_form.submit();
    top.location = "/nav_to.do?uri=%2Fincident_list.do";
}

However, I have NO idea how to do this with a reference qualifier.