Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Restrict assignment groups based on account on case record.

Anwar2
Tera Contributor

Hi Team,

 

I need to restrict the assignment group field on case record.

If account  A( 'account.u_partner_owned=true') is selected on case record it should show A assignment group.

If account B('account.u_customer_owned=true') is selected on case record it should show B assignment group.

else all the assignment group should available.

 

Already a refernce qualifier available the on this field as its extended from task table.

I have to make the is dictionary override.

 

I am trying it through script include and call that in reference qualifier but failing.

Can someone help me on this.

 

Thanks,

Anwar

1 REPLY 1

Anirudh Pathak
Mega Sage

Hi @Anwar2 ,

In your dictionary override, check the "Override reference qualifier" and use the below code to call the script include - 

"javascript: new YourScripIncludeName().YourFunctionName(current.u_partner_owned,curent.u_customer_owned);"

 

 

 

Use below code in your script Include - 

 

 

 

 

getGroups: function(owner,owned) {
        var arr = [];
        if (owner == true) {
           var grp = new GlideRecord('sys_user_group');
            grp.addQuery('name','YourGroupName');
            grp.query();
            if (grp.next()) {
                arr.push(grp.getValue('name'));
            }
			
        }
	else if (owned == true) {
           var grp = new GlideRecord('sys_user_group');
            grp.addQuery('name','YourGroupName');
            grp.query();
            if (grp.next()) {
                arr.push(grp.getValue('name'));
            }
			
        } 
	else {
            var grp = new GlideRecord('sys_user_group');
            grp.addActiveQuery();
            grp.query();
            while (grp.next()) {
                arr.push(grp.getValue('name'));
            }

        }
       return 'nameIN' + arr;
    }