Custom Prepopulation/Visibility on MRVS

Arjit Gourav
Tera Contributor

We have a custom scenario on a specific catalog item to (i)prepopulate certain set of variables on load of the MRVS & (ii)make them visible true . However, on the change of another variable present in MRVS, we need to (iii)prepopulate  another set of variables & (iv)make these current set visible true, alongwith (v)making the previous set of variables as visible false.

 

To achieve this, we have two different set of catalog client scripts & script include.

 

We are not able to achieve the fifth point (v) mentioned. Any suggestions would be appreciated.

 

Thanks.

4 REPLIES 4

Brad Bowman
Kilo Patron
Kilo Patron

It would help if you show what you did to achieve the first 4 objectives.  If point (v) is referring to variables within the MRVS, you should have used an onLoad Catalog Client Script (that applies to the MRVS, not the Catalog Item) in this case to achieve point (ii).  If you used a Catalog UI Policy with the On load box checked, there could be a conflict with the onChange Catalog Client Script that achieves points (iii), (iv), and (v).  The last two can be accomplished with a setDisplay line for each MRVS variable - true or false, but keep in mind that if any of these variables are mandatory, you must first setMandatory to false before attempting to setDisplay to false.

Arjit Gourav
Tera Contributor

@Brad Bowman  , Might not be able to add any part of code due to restrictions. But can explain what I am doing. All of the actions are inside a MRVS row only. Nothing on catalog item level.

So for achieving all of the points, I am utilizing 2 pair of client scripts & script includes.

 

For achieving (i) & (ii), have used an onLoad catalog client script & script include for this. The role of script include here is to fetch particular values from certain table and with client script, we are setting the values to the variables (Note:- we are  having a common backend name of the variables in MRVS so setting the values to variables/ making only those specific variables visible using a for loop).

 

Now for (iii) & (iv), using another set of onChange Client Script & Script Include. Here with the change of a reference variable within MRVS, i am referring that particular referenced value to a table and doing some other conditional operations in Script Include. After getting the value from script include, I'm again setting the values to some other set of variables (not necessarily the same as before).

 

No mandatory operations to be covered. It's all about showing up visibility for only those variables carrying a value at the same moment i.e. onLoad of the MRVS some x1, x2, x3, x4 variables to show up with prepopulated values but on change of the referenced variable(R1) in MRVS,  y1,y2,y3,y4 variables to show up with values & x1,x2,x3 & x4 should be made hidden. We also have cases where y1, y2,x1, x2 might show up in scenario (iv) where previous values of x1,x2 will be cleared out But that part is not a blocker for us.

The blocker is how to hide those variables which were shown on the Load but are not needed now after onChange of R1

Since the MRVS variables are not mandatory, and you aren't using any Catalog UI Policies in the MRVS, you should be able to clear and hide them with a simple script onChange of whichever variable

g_form.clearValue('var_name');
g_form.setDisplay('var_name', false);
...

with the same two lines for every variable you want to be hidden.  If it is not working, try a simplified mockup in a PDI, so you can share the generic setup and scripts if needed.  

Arjit Gourav
Tera Contributor

@Brad Bowman  , I was able to achieve the solution with some changes and turns in looping conditions. Thanks much for your support. Apologies for delay in confirming this