Auto populate the Assignment group based on cmdb class

vema saikumar
Tera Contributor

Hi All,

I have a requirement.If I select the causing ci in the problem table and that ci is related to specific cmdb class then the assignment group should be auto populated .

ex:If cmdb class name =generic and then if  I select any ci item of that class the assignment group should be auto populated as problem management group.

please Help

Thanks

Saikumar

4 REPLIES 4

AMan1997
Tera Guru

Hi,

 

Try writing a OnChange client script, which invokes when you select the CI on form. 


It calls a Script Include. Which you use to get CMDB class name and and similarly fetch the assignment group in there.

return the group value and in the client script set the returned value in 'group' field.


Let me know in case of any concerns.

Please mark the answer helpful/correct based on impact!

Thanks,

can you please provide script .I am new to servicenow

Sai Kumar B
Mega Sage
Mega Sage

@vema saikumar 

You can try the Before Business rule without scripting if you're looking for specific Class name

 

Condition

First click Show related and Choose Configuration Item -> Configuration Item Fields -> Class
For example, i have taken a server class you can choose as per your requirement

find_real_file.png

 ACTIONS


Choose Group as per your requirement
find_real_file.png

Sai Kumar B
Mega Sage
Mega Sage

@vema saikumar 

If you want dynamic try the same Business rule 

condition

find_real_file.png

SCRIPT

(function executeRule(current, previous /*null when async*/) {

	if(current.cmdb_ci.sys_class_name){
		current.setValue('assignment_group', 'group_sys_id') //If you want to choose group from cmdb_ci record you can do as Dot-walking current.cmdb_ci.group_field_name
	}

})(current, previous);