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

Thank You!
Juhi Poddar

View solution in original post

12 REPLIES 12

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

Thank You!
Juhi Poddar

Hello @RyoyaFukuda, Since dot walking has a problem, alternatively, you can try following a simple client script to make the field mandatory/non-mandatory. Please adjust the field name accordingly, if required

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
    if (isLoading || newValue === '') {
        return;
    }
    var category1LevelValue = g_form.getReference('category1Level', myCallback);

    function myCallback(category1LevelValue) {
        if ( category1LevelValue && category1LevelValue.name != 'Test1' && category1LevelValue.name != 'Test2' ) {
            g_form.setReadOnly('u_int', true);
			return;
        }
		g_form.setReadOnly('u_int', false);
    }
}

 

Regards,

Nishant

shubhamseth
Giga Sage

@RyoyaFukuda 

 

u_field_name is not test1
AND
u_field_name is not test2

 

 

Issue resolved? → Mark as Correct


Found value? → Mark as Helpful