Making Service offering field mandatory in Change Request Form

Piyush Dwivedi
Tera Contributor

In Change Request form how to make service offering field mandatory When a user selects a Service in the "Service" field that belong to Business Service or Technical Service CI class

1 ACCEPTED SOLUTION

Hi @Piyush Dwivedi 

 

Make sure you added the table first in UI policy

 

DrAtulGLNG_0-1749136406021.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

View solution in original post

22 REPLIES 22

Bert_c1
Kilo Patron

One way is to create a client script that runs onChange for the 'Service' field. In the script section, add something like

 

   var srvc = g_form.getValue('business_service.sys_class_name');
   if (srvc == [sys_id of Business Service] || srvc = [sys_id of Technical Service CI class]) {
         	g_form.setMandatory("service_offering", true);
   }

 

I'll try testing soon. see if the dot-walk logic works.

YaswanthKurre
Giga Guru

Hi @Piyush Dwivedi ,

 

  1. Create an onChange Client Script on the "Service" field:

    • This script will trigger when a user selects a service.
  2. Use GlideAjax to call a Script Include:

    • The Script Include will check the class of the selected CI (Configuration Item).
    • It should return true if the CI is a Business Service or Technical Service.
  3. Based on the result, set the Service Offering field as mandatory or not.

Mark this as helpful and correct if this helpful.

Thanks,

Yaswanth.

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @Piyush Dwivedi 

 

You can try teh UI policy by dot walk:

 

DrAtulGLNG_0-1749134057782.png

 

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

In UI Policy for Change Request Form can we filter a condition with Class?