UI Policy Best Practice Question

Ziad Qadora
Kilo Sage

Hello,

We are using a record producer to create case tasks, and the record producer have several variable set, and we currently we have  catalog UI policies some applied to the Catalog item and others to the various variable set.

One of the variable set UI policies that makes the field mandatory and visible if another field is set to Yes, but we recently had an additional requirement to not hide the field if case category is set newly added category.

I have seen in the community that it is not best practice to do scripting in the UI policy and instead to use Client Scripts. But I feel this may make harder in the future to debug issues since UI Policies related to one record producer may exist in several different places. 

Thus, what would is the best practice when many policies applied to Catalog item, in addition to many applied to the variable sets, and one more needs to be applied using client scripts.  Or is this just normal course and there no issues with it?

Moreover, why scripting inside the UI policy is not best practice and instead to it is better to use client scripts when trying to create UI policy based on change on both the form and inside the variable set.

Thank you for your insights, looking forward to hear back to hearing your feedback on this.

 

Regards,

Ziad

1 ACCEPTED SOLUTION

Ziad Qadora
Kilo Sage

Hi,

I was to accomplish what I need by a UI policy applied to the catalog item for the field for which the needed action is based on a field that is not part of the same variable set.

I used UI policies applied to the variable set for the fields for which the needed action depends on a field in the same variable set.  

This was accomplished without any scripting, which based on what I gathered is not best practice.  Please see the link below

https://community.servicenow.com/community?id=community_question&sys_id=dc4c79a8db7e3300d82ffb2439961945&view_source=searchResult

 

Regards,

Ziad

View solution in original post

2 REPLIES 2

Sai Kumar B
Mega Sage
Mega Sage

@Ziad Qadora 

If you have multiple UI policies with scripts inside, My suggestion would be to go with the client script and apply all the UI policies logic over there in one place same goes in variable set client script as well

Moreover you can run clients scripts on Mobile UI as well

Ziad Qadora
Kilo Sage

Hi,

I was to accomplish what I need by a UI policy applied to the catalog item for the field for which the needed action is based on a field that is not part of the same variable set.

I used UI policies applied to the variable set for the fields for which the needed action depends on a field in the same variable set.  

This was accomplished without any scripting, which based on what I gathered is not best practice.  Please see the link below

https://community.servicenow.com/community?id=community_question&sys_id=dc4c79a8db7e3300d82ffb2439961945&view_source=searchResult

 

Regards,

Ziad