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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2019 11:44 AM
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 fields
i want to use UI Policy to achieve it.
, 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.
i don't know why . could anyone give some advise? thanks in advance.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2019 11:39 PM
>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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2019 11:24 PM
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

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2019 01:42 AM

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2019 11:06 PM
Hi,
you can try updating the order of the ui policies using the same fields to be different.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-23-2019 01:43 AM
I wrote 3 UI Policies, Order is 100,200,300.
It didn't work .