UI polices condition

RyoyaFukuda
Tera Contributor
Hi all
I would like to create a similar condition in a UI policy, using the following client script condition as a reference.
The feild type for which “newValue” is set is String.

if
(!(newValue=== 'test1' ||newValue=== 'test2' )){
}

I am having trouble getting it to work.
1 ACCEPTED SOLUTION

Hello @RyoyaFukuda 

  • Since you're using dot-walking and the content field is not directly present on the form, UI Policy changes won’t reflect immediately. This is because dot-walked fields are not truly client-side editable and don’t trigger UI Policy evaluations the same way direct fields do.
  • However, if you're working with a reference field that is directly on the form (not dot-walked), UI Policies should work as expected in real time.

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

View solution in original post

12 REPLIES 12

Rafael Batistot
Tera Sage

Hi @RyoyaFukuda 

 

Consider this solution for your case 

var fieldValue = gForm.getValue('your_field_name');
if (fieldValue !== 'test1' || fieldValue !== 'test2') {
return true;
}
return false; 

I would appreciate it if you could provide the condition for the UI policy.

Juhi Poddar
Kilo Patron

Hello @RyoyaFukuda 

Try this in UI policy, the condition can be written as:

Field IS NOT test1
AND
Field IS NOT test2

 

This should works because:

!(A || B)  = !A && !B

Hope this helps!

 

"If you found my answer helpful, please like and mark it as an "accepted solution". It helps future readers to locate the solution easily and supports the community!"

 

Thank You
Juhi Poddar

@Juhi Poddar 
thank you 
Does this apply to Related Field as well?
I could confirm that it worked fine for normal fields, but when I looked at the referenced field, it did not work.