Service Offering Mandatory for Technical or Business Service

Piyush Dwivedi
Tera Contributor

Issue is, when i am selecting technical service in "Service" field of Change form then after submitting the Change record the "Service offering" field getting mandatory automatically as per my expectations.

further to this when i am changing Service in "Service" field as Non Technical or Business service and then againing clicking update the change record then it's not allowing me since Service offering is mandatory,

I am try Dot walk UI Policy.

so, can we have a solution for this where Service offering gets optional once we select no Technical or Business service?

 

 

1 ACCEPTED SOLUTION

Define a client script for the incident table, as you have for the change_request table. The same Script Include can be used by any number of client scripts. You can copy the client script and just change the table from 'change_request' to 'incident'. 

View solution in original post

21 REPLIES 21

The logic in the Client script "toggles" the "Service Offering" being mandatory or not when the "Service" value changes. First screenshot shows a "Service" selection that is not from either Class. The second screenshot shows when a "Service" selection is from either Class.

Screenshot 2025-06-11 132447.pngScreenshot 2025-06-11 132505.png

@Bert_c1  I used your client script + Script include + my UI Policy to fulfil the requirement to work.

Only client script + script include is not fulfilling the requirement,

can we do it , please suggest?

Hi @Piyush Dwivedi 

 

In the client script, please remove the check for 'newValue === '' in the first if statement and use:

 

   if (isLoading) {
      return;
   }
   // check for blank value
      if (newValue === '') {
         g_form.setMandatory('service_offering', false);
   }

 

so when the value is cleared, the Service Offering is not mandatory.  If you're still having problems. Post screenshots of the client script and script include. Both have been tested in my instance.

I tried Client Script & Script Include without UI Policy After submitting a Change Request Service Offering field gets optional (with filled value ) for Service (Business or Technical Service)

Do you want me to enable UI Policy Dot walk filter as well? with Client script + Script include?

No, the UI Policy didn't work for you, I don't have that in my instance. Just the client script and script include.

 

Now you use " Service (Business or Technical Service)" for your two Classes where Service Offering is mandatory.  What I have in the Script Include are what I believe you're referring to. I determine this by view tables extended from the Service (cmdb_ci_service) table And I see the following:

Screenshot 2025-06-11 172938.png

So I have 'cmdb_ci_service_business' and 'cmdb_ci_service_technical' as the two desired services. and I see those 5 classes when I look at a list of records in the cmdb_ci_service table. I don't know what you have in your instance. Please review that.