Avoid creating UI policy action on the same variable that might cause conflicts.

Bindhu1
Tera Contributor

Hi community,

I have a requirement here. When the checkbox is checked, the following two variables are visible and mandatory (which can be done by a simple UI policy). Additionally, I have one more requirement: If the first mandatory variable is filled out, the other becomes non-mandatory, and vice versa. Is this achievable? If so, how?

Bindhu1_0-1712813371505.png
Furthermore, I prefer to avoid creating another UI policy on the same variable that might cause conflicts.

Thank you.

1 ACCEPTED SOLUTION

AakashG0904
Tera Expert

Hi @Bindhu1,

Hope you are doing well.

 

Proposed Solution

As a solution, Request you to have a look at the points mentioned below: -

  1. For your 1st requirement to make both the Fields Mandatory as the Checkbox is marked as Checked, you can write either the Client Script or UI Policy.
  2. For your 2nd requirement to make the Other Field as Non-Mandatory when the First Field is not Empty or vice-versa, you can write either the Client Script or UI Policy for the same as well.
  3. If you create another UI Policy on First/Second Variable of Type String, it will not conflict with the first one and If you are not feeling comfortable with UI Policy, you can even go for Client Script as well. It's totally as per your choice. But both will fulfil your requirement.

 

If you will still face same issue or doubts, you can let me know to implement the same on my Personal Developer Instance that will be helpful for you to get your ask or query solved as soon as possible.

 

If you find this information/knowledge/solution as helpful, please do not forget to mark the same as Helpful and Accepted as a Solution.

 

Thanks

Aakash Garg

ServiceNow Developer

View solution in original post

1 REPLY 1

AakashG0904
Tera Expert

Hi @Bindhu1,

Hope you are doing well.

 

Proposed Solution

As a solution, Request you to have a look at the points mentioned below: -

  1. For your 1st requirement to make both the Fields Mandatory as the Checkbox is marked as Checked, you can write either the Client Script or UI Policy.
  2. For your 2nd requirement to make the Other Field as Non-Mandatory when the First Field is not Empty or vice-versa, you can write either the Client Script or UI Policy for the same as well.
  3. If you create another UI Policy on First/Second Variable of Type String, it will not conflict with the first one and If you are not feeling comfortable with UI Policy, you can even go for Client Script as well. It's totally as per your choice. But both will fulfil your requirement.

 

If you will still face same issue or doubts, you can let me know to implement the same on my Personal Developer Instance that will be helpful for you to get your ask or query solved as soon as possible.

 

If you find this information/knowledge/solution as helpful, please do not forget to mark the same as Helpful and Accepted as a Solution.

 

Thanks

Aakash Garg

ServiceNow Developer