using a condition builder for a UI Policy to dot walk a reference field

patricklatella
Mega Sage

I'm trying to use a UI Policy on a catalog item to make a field mandatory based on the reference variable to the sys_user table.   Is this possible?   Would a client script be better?

My variable is "user", and it's a reference field to the sys_user table.

I am then seeing the following in my condition builder:

find_real_file.png

but if I dot walk that to a field on the user record and set it to something that looks like it should work, it doesn't seem to apply correctly.

find_real_file.png

1 ACCEPTED SOLUTION

please try to have if statements inside curly braces {}, like



if(region == 'NA')


{


//Your code if condition code;


}


else


{


//You else condition code;


}


View solution in original post

14 REPLIES 14

Arindam Ghosh
Mega Guru

Hi Pat - This should work without any issues.



Thanks,


Arindam


Shishir Srivast
Mega Sage

Hi Patrick,



It's doesn't work for me either, i tried in this way:



find_real_file.png


even though field is blank it's applying the UI Policy Actions.


find_real_file.png


Can we try with catalog client script using getReference() function and see if it works,



function onChange(control, oldValue, newValue, isLoading) {


    var caller = g_form.getReference('User', doAlert);


}


function doAlert(caller) {


  if (caller.u_support_region == 'Americas - US and Canada'){


            g_form.setMandatory('Field Name', true);


}


patricklatella
Mega Sage

Hi Shishir,


I wrote a catalog client script to achieve this too, but I'm having trouble with the "else" part of it,



What is the error with this on the "else" statement?   I need it to set the field to "not mandatory" if the "if" condition is not met



find_real_file.png


please try to have if statements inside curly braces {}, like



if(region == 'NA')


{


//Your code if condition code;


}


else


{


//You else condition code;


}