- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2018 08:01 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 06:28 AM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-28-2018 08:14 AM
Where these field created on the cmdb_ci Table? If so you could just build your client script on that table and it should work for all classes.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 02:11 AM
My bad, beginners' mistake. For whatever reason the Inherited field was not visible on form.
I just learned something 🙂
Cheers,
Florian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 12:41 AM
Hi brian,
Unfortunately no, this doesn't work. It's actualy the first thing I did "hoping" it will work, but I'm pretty sure it works only for fields on extended tables 😞
Any other idea ? 🙂 (By the way, I tried the Base table too, same thing :))
Regards,
Florian
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-29-2018 01:05 AM
Did you tick the inherited tick box on the client script? It should then apply to any tables to which that field is extended.
To be honest, you should be able to achieve this requirement with a single UI policy. Set the condition to 'u_field_name is empty' and set the action to make the field mandatory, tick reverse when false, on load and inherit and it will make that field mandatory when the field is empty or changes to empty.
Best practice is to use UI policies to manage mandatory fields.