UI Policy Catalog Conditions Related Fields
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2018 02:22 AM
I have a requirement that states make "Phone " field mandatory and visible on a form if it is empty in "User" Table for the user selected on form.
I have to perform these actions using UI Policy only.
The script should be as minimum as possible.
How can I add a new field to related fields list in Catalog conditions for a UI Policy.
Please suggest some solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2018 04:55 AM
Hi Rahul
The best approach will be to create a glideajax call to check the users phone. See the below doc to understand how the glideajax work
Examples of asynchronous GlideAjax
There is another below script using the getReferencethat will also work , but this is not suggested as a good approach from performance perspective.
var usr = g_form.getReference('USER_FIELD_NAME', iSPhEmpty);
function iSPhEmpty(usr){
if (usr.phone == '')
g_form.setMandatory("PHONE_FIELD_NAME",true)
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2018 05:16 AM
Hello Harsh,
Thanks for the response.
.
Can't this be done using conditions in UI policy?
How can I specify change of user in conditions and refer "Phone" field in User Table?
There is "user" variable on form which refers "User" Table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2018 07:35 AM
Unfortunately not, We cannot dotwalk the variable in the condition field.The dot walk of the reference fields in the condition work only for the actual field on the table.
-Harsh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2018 07:22 AM
Hi Rahul,
try a onchange client script.
- function onChange() {
- }
- var ph= g_form.getValue('user.mobile_phone'); //dot walking to the user phone filed.
- if(ph == ''){
- g_form.setMandatory('variables.example1', true); //variables.'your variable name'
- }
Hope this helps.