Will a UI Policy's 'Execute if true' script only run at load time? It doesn't seem to run whenever the fields are changed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 12:38 PM
For example, on the project task, I created a test UI Policy below:
function onCondition() {
if (g_form.getValue('time_constraint') == 'asap') {
g_form.setReadonly('end_date', true);
}
}
This very simple rule doesn't change the read only of the end_date field whenever the time_constraint field is updated. It will, however, work properly if you change the time_constraint and then save the form. When the form is reloaded, the field is then properly read only or not.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 03:10 PM
There is no reason that I can think of why that wouldn't work. I tried a similar function on our test instance and it worked fine.
The only thing that throws me every once in a while is that the condition in the UI policy needs to be true before the UI policy script will be invoked. So if, for example, your condition on your test UI policy is that State = "Resolved", the state value must be Resolved before the UI policy script will run. It won't work the other way.
In other words, think of the UI policy as the simple way to create a javascript onChange function.
Hope that helps.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-07-2014 09:22 PM
UI Policy will work like an onChange client script only if there is a condition associated with the UI policy something like State = Resolved. So now when the State changes to Resolved, you UI policy will get triggered.
Also if you change the state to InProgress, the 'reverse if false' of UI policy will get triggered and your UI policy will run and will revert all the UI policy actions. So in both the case the UI policy will run but you will have to ensure that the condition field is using your field which is changing.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-10-2014 05:12 AM
Gary, what did you end up doing here? I'm having a similar situation when using a UI Action - it triggers and beats out the UI Policy.
In this case, I'm trying to enforce Mandatory fields when the State is changed, but the UI Action switches the State and saves the record. If you go back, the enforcement is in place.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-10-2014 08:25 AM
Hey, we just ended up using a client script.