using UI Policy check field Mandatory, but sometimes it seems didn' t work

zhihong
Tera Contributor

hi experts,

I have a requirement , when both of the following conditions are met, it need to check some fields Mandatory. All of those fields Mandatory check is before  clicking update button.

1. states=closed;

2.when u_wi_update = 1-7, checking related fieldsfind_real_file.png

i want to use UI Policy to achieve it.

find_real_file.pngfind_real_file.png

find_real_file.pngfind_real_file.pngfind_real_file.pngfind_real_file.png

, but it always have some check errors.

for example, when i choose "1:xxxxxx", it check 4 fields Mandatory, it hasn't error , but if  i change to "3:xxxxxx" , it just check 1 fields.

find_real_file.pngfind_real_file.png

i don't know why . could anyone give some advise? thanks in advance.

19 REPLIES 19

>did you try to make other ui policy as true and rest of two are active false ? other one is also creating an issue ?

I tried to only make UI Policy2 is true(u_wi_update = "3:xxx") , other two is false.  It is right. Also only make UI Policy3 is true(u_wi_update = "4:xxx || 5"xxx ||6:xxx"), other two is false.  It also is right. However,  if I make UI Policy2 and 3 both are true, UI Policy1 false, it has check errors: choose u_wi_update = "4:xxx", and make states= closed, it check 2 fields, no problem,  but changing u_wi_update from  "4:xxx" to "3:xxx"  it should check 4 fields but 2 fields.

>have you written any script in UI Policy ? 

I wrote script in UI Policy before, but I had deleted it.

>i am assuming here there is not other ui policy which try hide the mandatory fields? 

I have another UI Policy just make u_wi_update Mandatory, and make other fields read only.

I don't know why .

Anyway thanks for helping me so much.

 

Hi again,

I realise that I misinterpreted the Work Identification Name Update field values to be choices, not a Reference field.

You can account for the references by using their sys_ids in concert with the below:

var wi = g_form.getValue('u_wi_update');

if(wi == '*sys_id_here*'){
// Action
}

The reason I recommend this method is that it is more reliable and less likely to be impacted by changes or other UI policies. As the other commentors mention, you can do this without scripting but it means you have more UI policies to manage. This can be more prone to cause issues down the track. As such, I'd recommend my method.

It also appears that another UI policy is acting on the u_employee_number field.

Kind Regards,

Astrid Sapphire

hi Astrid,

I have changed it .

but when change 'u_wi_update' from 1:xxxx to 3:xxx , the Mandatory not change, change 'u_wi_update' from 3:xxxx to 5:xxx , it still check 4 fields

find_real_file.png

Vigneshwar Red1
Kilo Guru

Hi,

you can try updating the order of the ui policies using the same fields to be different.

I wrote 3 UI Policies, Order is 100,200,300.

It didn't work .