Assignment group and Assigned to field population

JSOP
Tera Contributor

I have a scenario if assignment group is not empty but hidden on a form and the assigned to field is not populated, requester can manually  populate from available  group members. However, if assignment group is empty and the assigned to field is empty too, route to another team. 

4 REPLIES 4

Abbas_5
Tera Sage
Tera Sage

Hi @JSOP,
Please refer to the below link:
https://www.servicenow.com/community/developer-forum/how-to-auto-populate-assignment-group-and-assig...

 

If it is helpful, mark it as a thumbs-up and accept the correct solution.
Thanks & Regards,
Abbas Shaik

Utpal Dutta
Tera Guru

Hi JSOP,

I'm a bit confused with your first line. How can assignment group is not empty and hidden on a form?

But If you're trying to populate Assignment group when Assigned to is empty then you should write an onLoad client script because on load both of the fields will be empty.

If you want it to run onChange then you can write the same script onChange of the form as well you just need to select on which field change you need to run below script.

 

var assigned = g_form.getValue('assigned_to');
if(!assigned){
g_form.setValue('assignment_group', 'sys_id_of_assginment_group_to_set');
}
else{
g_form.clearValue('assignment_group');
}

 

If my answer helps then please mark it Helpful or Correct!

 

Thanks,

Utpal

JSOP
Tera Contributor

@Utpal Dutta @My apologies for the confusion. This is on the catalog item on the service portal. Not all the form fields are visible to the end users. There is a scenario where an incident group as just been newly created  currently with no group members  for a specific domain. Where there are other groups with members and end users can select any member of the group to assign their incident to..

PS/ I  am new to scripting  and trying to get the hang of it. Thanks

JSOP
Tera Contributor

Still trying to get an answer to this question. Service drives the assigned to field. service is not empty and assigned to is empty but has members to select from, make field mandatory so that.(requester must select a member)  Also, service is not empty and assigned is empty with no members at all. Assigned to non mandatory, Show message: route to for example: security team. The assignment group field is hidden on the form, so service  drives the assigned to field. I need an onchange client script to execute this