Scripting a reference qualifier for lookup select box variable to be dependent on another variable

JJG_SNOW
Mega Guru

I have two variables in a catalog item. The first is a lookup select box. The other is a select box with two choices, User & Shared.

 

Once the user makes a selection, either User or Shared, I want the lookup select box to only show records who's "mailboxtype" (mailboxtype is a field in the table) matches the selection. I tried modifying the ref qualifier using g_form.getValue() to capture the users selection, but now it's not returning any records: mailboxtypeLIKEg_form.getValue("type_of_mailbox");

 

 

JohnGilmore_0-1674576983238.png

 

Here is an example of a record in the lookup select box table. The MailboxType is "Shared". Therefore, if the user selects "Shared" as the type on the catalog item, this record should appear in the list.

 

JohnGilmore_1-1674577249873.png

 

Catalog Item:

JohnGilmore_2-1674577550901.png

 

 

 

 

1 ACCEPTED SOLUTION

JJG_SNOW
Mega Guru

I was able to achieve with the following ref qualifier: javascript:'mailboxtypeLIKE'+current.variables.type_of_mailbox;

View solution in original post

2 REPLIES 2

emily1
Tera Guru

Here is what I would try:

 

Assume your Type of Mailbox variable's name is 'mailbox_type'

 

Create two mailbox list collector variables

  1. user_mailbox
  2. shared_mailbox

For these variables, configure them as follows:

Hidden = true

Under type specifications: your reference qualifier should be, for example, type=shared or type=user (whatever you would use to filter the table with the results you need)

 

Create a catalog client script:

Name: 'show list depending on value'

Type: onChange

Variable name: mailbox_type

Script:

**make sure to configure UI type on script properly

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

if (isLoading || newValue == '') {

var device = g_form.getValue('mailbox_type');

if (device == 'shared') {

g_form.setVisible('shared_mailbox', true);

g_form.setMandatory('shared_mailbox', true);

} else {

g_form.setVisible('shared_mailbox', false);

g_form.setMandatory('shared_mailbox', false);

}

 

if (device == 'user') {

g_form.setVisible('user_mailbox', true);

g_form.setMandatory('user_mailbox', true);

} else {

g_form.setVisible('user_mailbox', false);

g_form.setMandatory('user_mailbox', false);

}

JJG_SNOW
Mega Guru

I was able to achieve with the following ref qualifier: javascript:'mailboxtypeLIKE'+current.variables.type_of_mailbox;