Client Script on all CMDB classes

Florian CHAMOI1
Giga Expert

Hello Experts !

I would like to apply a Client Script on all CMDB classes. My requirement is to display a field as mandatory when another one changes to not empty, as well as the reverse.

I successfuly did this on a cmdb_ci_server with a (well, two) simple client script, and I'd like to apply this on all the cmdb. I thought this would be fairly simple, but I'm either wrong or missing something.

Would some kind soul be able to guide me ? Obviously, I'd like to avoid creating two Client scripts per CMDB class 🙂

 

Thanks a lot for your help !

Regards,

Florian

1 ACCEPTED SOLUTION

Hi Florian,

If i understand your requirement properly you need the owned by field to be mandatory when the support group changes to not empty and vice versa?

If you tick the 'reverse if false' tick box and set the condition to be 'support group is not empty' then when the condition is matched the policy action will make the owned by field mandatory, when the condition is not matched the field will be non-mandatory. It will change dynamically on the form as the field changes.

Basically, UI policies can operate on load and, to an extent, on change. If your on change conditions go beyond a simple field value change or you need to do more than make a field mandatory/read-only/visible then you'll need a client script, otherwise you can use a UI policy.

Cheers

Dave

View solution in original post

7 REPLIES 7

Hello David,

 

thanks for your insight 😉

As I answered to Brian, it was indeed the Inherited checkbox.

I would gladly have done this with UI Policy, unfortunately my triggering condition is onChange and not onLoad (owned_by mandatory when support_group changes).

 

Regards,

Florian

Hi Florian,

If i understand your requirement properly you need the owned by field to be mandatory when the support group changes to not empty and vice versa?

If you tick the 'reverse if false' tick box and set the condition to be 'support group is not empty' then when the condition is matched the policy action will make the owned by field mandatory, when the condition is not matched the field will be non-mandatory. It will change dynamically on the form as the field changes.

Basically, UI policies can operate on load and, to an extent, on change. If your on change conditions go beyond a simple field value change or you need to do more than make a field mandatory/read-only/visible then you'll need a client script, otherwise you can use a UI policy.

Cheers

Dave

True, I was stuck on the onChange logic I guess and forgot UI Policy does it too.

Thanks for your insight, worked perfectly and way more simply.

Cheers,

Florian