Catalog UI Policy - Expose Variables Based on Attribute of Reference Selection

lawrencemgann
Tera Guru

Hello Community!

 

Is it possible to script a catalog UI policy based on the selection in a reference variable?  The design I'm trying to achieve is like this:

 

  1. Reference variable on sys_user "who is the employee involved?"
  2. User selects the employee
  3. If employee.userField == X, expose additional variables

Can a UI policy of this sort be scripted?

 

If so, should I be concerned about performance implications of a real time check against the user record field?

 

lawrencemgann_0-1719328646981.png

 

1 ACCEPTED SOLUTION

Sample script

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ref = g_form.getReference('<user reference var name>', usrObj);
    }
function usrObj(ref) {
        if(ref.<X> == <whatever>)
        //show variables
    }
}
-Anurag

View solution in original post

3 REPLIES 3

Anurag Tripathi
Mega Patron
Mega Patron

Hi,

You cant dot walk in UI Policy Conditon.

But you can achieve the same using a catalog Client script  which runs on change of User Variable. 

You can check the user attribute using Glide Aajx or GetReference 

And based on that you can make other variables visible.

-Anurag

Sample script

function onChange(control, oldValue, newValue, isLoading) {
    if (isLoading || newValue == '') {
        return;
    }
    var ref = g_form.getReference('<user reference var name>', usrObj);
    }
function usrObj(ref) {
        if(ref.<X> == <whatever>)
        //show variables
    }
}
-Anurag

Thank you for these configuration details and the example script!  This is exactly what I needed.