Empty assigned_to list when assignment group is empty

RamSagar
Tera Guru

Hi,

I had a requirement to empty the assigned_to list when the assignment group is empty.

So that users should not be able to select the assigned_to before assignment group is selected.

4 REPLIES 4

chirag_bagdai
ServiceNow Employee
ServiceNow Employee

Hi Ramu,



Can you please try to create onChange Client Script for "Assignment group" field and in that client use below script to make assigned to blank when assignment group is blank:



  1. if(!g_form.getValue("assignment_group")) {  
  2.         g_form.setValue('assigned_to','');  
  3. }  


I hope this helps.Please mark correct/helpful based on impact.



Let me know in-case of any question.



Regards,


Chirag Bagdai


Chris M3
Tera Guru

The simplest solution would be a UI Policy making Assigned To Read Only when Assignment Group is Empty, along with a UI Policy script that would also clear out assigned to when assignment group is empty.



I would question the requirement though.   As someone who has worked in a support role on a system that did not allow picking the assigned to person first, it was always difficult to find the correct assignment group if I knew who it needed to be assigned to, but didn't necessarily know the team..


shloke04
Kilo Patron

Hi,



As mentioned by Chris, it's better to do the above requirement using the UI Policy itself clearing the value of the field and making it Read Only i.e. restricting the users from selecting the Value. This is because even if you clear out the Value of Assigned To field as mentioned by Chirag I guess User can still select the Value from the Reference List of Assigned To field.



Below is the UI Policy with script which needs to be configured to achieve the same:



find_real_file.png



find_real_file.png



Hope this helps.Mark the answer as correct/helpful based on impact.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke

shloke04
Kilo Patron

Hi,



Did you got a chance to review the solution proposed, if your query is Resolved please mark the answer as correct and close the thread.



Regards,


Shloke


Hope this helps. Please mark the answer as correct/helpful based on impact.

Regards,
Shloke