how to show tree selection values with following criteria?

IVB2020
Kilo Contributor

Hi all,

Tree Structure:

Root =  Global

Node 0 = Country

Node 1 = Sites

Table is "Location"

Only values in Node 1 will be saved in "Location". Node 0 and Root will be used as a helper to automatically select values within its hierarchy. Selecting Root will automatically select ALL Node 0 and Node 1 values within its hierarchy. Selecting a Node 0 value will automatically select all Node 1 values within its hierarchy. De-selecting a Node 1 value de-selects its corresponding Node 0 and Root, if applicable. When reopening the Catalog Item, the tree selections will only show currently saved locations.

6 REPLIES 6

Thank You. And also is it possible to store these value in variable and next time when the same user opens the catalog item the variable has to show the previous value he has selected. Is it possible?

This is possible, but it's fairly complex depending on your skill level in the platform. You can save variable values as User Preferences with a bit of scripting. If you are planning on setting the User Preference from a client script, you would want to use the g_user.getClientData() and g_user.setClientData() functions. The documentation for this can be found here.

Here's a bit of example code to get you started.

// put this in an onChange client script for the field value you want to capture
if (newValue) {
  g_user.setClientData('some_catalog_item_some_field', newValue);
}

// put this in an onLoad client script for the catalog item you want to pre-populate
var storedValue = g_user.getClientData('some_catalog_item_some_field');

if (storedValue) {
  g_form.setValue('some_field', storedValue);
}