- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 09:28 PM
Hi everyone.
Could someone help me with an onCondition( ) script inside UI Policy? Since I cannot dot walk using the GUI to > Country Code = 'Canada'.
I will need to write a script that does the following:
If the country code is 'Canada', make the field "interior" and "exterior" visible and mandatory.
These two fields will be available only for users in Canada.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 11:07 PM
@Leni Lunderman1 You can do dot walk in UI Policy. Follow below steps
1) Select table as "sn_hr_er_case (Employee relations)"
2) In the "When to apply" section, select "Show Related Fields"
3) Again click on same dropdown and Select "Subject Person --> User fields"
4) Again click on same drop down and This will allow you to select subject person user record fields.
Select country code field and its value
If I could help you with your Query then, please hit the Thumb Icon and mark as Correct !!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 09:31 PM
var countryCode = g_form.getValue('country_code');
if (countryCode == 'Canada') {
g_form.setDisplay('interior', true);
g_form.setMandatory('interior', true);
g_form.setDisplay('exterior', true);
g_form.setMandatory('exterior', true);
} else {
g_form.setDisplay('interior', false);
g_form.setMandatory('interior', false);
g_form.setDisplay('exterior', false);
g_form.setMandatory('exterior', false);
}
please mark helpful if its work
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 10:03 PM
Unfortunately, it didn't work. The field is still available for every user, no matter the country.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 10:44 PM
You need to put the condition in the 'When to Apply' section. Then put those script from above in Execute if true and Execute if false on 'Script' tab.
Or you can simply create an onchange client script for this.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2023 10:15 PM
@Leni Lunderman1 Do you want country code of logged in user or is there any field on form which contains user ID ?
Also are you trying to refer country code which is present in Sys_user table ?