OnLoad Client script to populate assigned to && assignment group

Alon Grod
Tera Expert

Hi,

 

I have the fields Assignment group and assigned to on incident table. I have a requirements to populate Assignment group as the 'caller' group and the assigned to as the caller.

How can I achieve that?

1 ACCEPTED SOLUTION

If you want to do it via OnLoad Client Script + Display BR then below code can help you

in Display BR

var caller = current.getValue('caller_id'); // mention proper column name of caller_id and it gives us the sys_id
	var gr = new GlideRecord('sys_user_grmember_list'); //navigating to group members and checking the user's groups
	gr.addQuery('user',caller); //As you have mentioned there will only be one caller to the group I'm going with if, else we need to use while
	gr.query();
	if(gr.next()){
		g_scratchpad.group = gr.group; //this will fetch you the sys_id of the group
	}

 

In Client Script

 if (g_scratchpad.group) {
            g_form.setValue('assignment_group', g_scratchpad.group);
g_form.setValue('assigned_to',g_form.getValue("caller_id")); //as you have mentinoed the assigned_To needs to be same as caller.
        }

       
Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

View solution in original post

9 REPLIES 9

Uncle Rob
Kilo Patron

Assignment rules, NOT onload client script.
Also, a user can be a member of multiple groups, so you need  to know what to do when that happens.
Also, you'll NOT want to make this a global thing, unless you want your entire incident experience being people creating tickets for their own work.  Quite simply this is not what Incident Management is supposed to do.

@Uncle Rob In my scenario every user is only assigned to one group

Basheer
Mega Sage

Hi @Alon Grod ,

There are multiple things which needs to be considered here:

1. Through assignment rules you can achieve this. ---> this is OOB functionality

2. OnLoad Client Script + Display Business Rule. ---> this is customised way, if you have other requirements which are not satisfied from option 1

3. OnLoad Client Script + Client Callable Script Include.

Please hit like button if my suggestion has helped you in any way.
Please mark correct if my response has solved your query.

Cheers,
Mohammed Basheer Ahmed.

@Basheer using assignment rules i can populate both assigned to and assignment group according to the caller?