Variable set should be visible on one particular catalog item.

Pavithra20
Kilo Contributor

Variable set is created, and the same variable set is using for many catalog items. Now the stakeholder asked to do some modifications like adding choice and depends on that choice the another variable should populate. 

Here request type is the variable and transfer mobile number is the choice, Whenever the request type is selected as transfer mobile number the acknowledgement variable will be visible on UI. This case should work on only one catalog item. As we done changes on variable set its reflecting in all catalog items that variable set contains. Please guide me how I can hide transfer mobile number and acknowledgement from another catalog items. Thanks in advance.

 

Please find the attached snaps for reference. The catalog items are added in included in. Please guide.

3 REPLIES 3

dmathur09
Kilo Sage
Kilo Sage

Hi Pavithra,

Write a catalog UI policy,

on your expected variable set,

write script like

function onCondition() {
if(g_form.getUniqueValue() =='94296d6e4fc3c2c0960f95bd0210c756'){//sys_id of your catalog item
g_form.setDisplay('acknowledgement',true);//first parameter your internal variable set name
}
}

Regards,

Deepankar Mathur

Sai Kumar B
Mega Sage
Mega Sage

@Pavithra 

Try the onChange client script in your variable set on the Request type variable

function onChange(control, oldValue, newValue, isLoading) {
   if (isLoading) {
      g_form.setVisible('acknowledge_variable_name', false); //OnLoad hide acknowledge variable
if(g_form.getUniqueValue() != 'cat_item_1_sys_id' || g_form.getUniqueValue() != 'cat_item_2_sys_id'){ //If the current item is not your both catalog items remove the transfer mobile option value
      g_form.removeOption('request_type_variable_name', 'option_value);
}
}

if(g_form.getUniqueValue() == 'cat_item_1_sys_id' || g_form.getUniqueValue() == 'cat_item_2_sys_id'){ //If any of the cat item sys_id matches then show acknowledge number based on request type variable option

if(newValue == 'transfer_mobile_option_value') { //Here newValue is Request Type variable new value
g_form.setVisible('acknowledge_variable_name', true);
}
}
}

Sai Kumar B
Mega Sage
Mega Sage

@Pavithra 

Is my response helpful to you? If yes, mark it as correct and close the loop it would help future readers as well.