How to Set Table View Preferences Based on User Groups and Conditions

Available since 16.0. Conditions are available since 17.2.

View Preferences for the tables on the Items tab of CLIC documents can be automatically loaded based on user groups or a condition (advanced filter). The setting is done in the JSON configuration of CLIC header types (Quote Type, Rebates & Agreements Type, Rebate Agreement Type or Compensation Type).

For each header type, you can define conditional preference types (collection of view preferences) and a default preference type. You can define preference types for the Items table and the Product, Product Group, Customer and Customer Group pickers.

How it works

  • When you define a preference type for a user group or a condition in the JSON configuration, users belonging to this group (and, where a condition is also set, whose document matches that condition) will see only the view preferences associated with this type. When a user belonging to this user group opens a document (e.g., Quote) creates and saves a view preference, this preference will be associated with the preference type defined for this user group. The user will also see all other view preferences created by other users belonging to the same group.

  • Conditional preference types are ordered by priority in the JSON configuration and each has one or more user groups assigned, an optional condition, or both.

  • A preference type entry can combine userGroups and condition. When both are present, both must be satisfied – the current user must belong to one of the listed user groups, and the document must match the condition – for that preference type to apply. An entry can also use condition on its own, with no userGroups.

  • The condition uses the same advanced filter structure as the table's own Filter panel (a full filter object, not just a single field/operator/value check), so any filter you could build in the UI can be reused here.

  • At runtime, conditional preference types are evaluated in order; the system uses the first conditional preference type where at least one assigned user group matches the current user’s group.

  • If no conditional preference type matches, the default preference type for that header type is used.

  • If no default is defined, the global default view preference is used. This view preference is set in the UI, in the tables Show Table Settings menu.

In the following example JSON configuration, you can see a conditional preference type for the Items tab – one combining a user group with a condition, one using a user group only, and one with neither and an incorrect definition of product picker preferences.

JSON
{
  "tabs": {
    ...
  },
  "buttons": {
    ...
  }
  "preferences": {
    "itemsTable": [  // Preference for CLIC detail items table. The order is important, configuration which is placed higher has higher priority.
        {
          "label": "user defined label",
          "preferenceType": "MySavedPreference1", // Name of the preference type which will be used when both the condition and user groups below match.
          "condition": {                            // NEW: Optional advanced filter. Uses the same structure as the table's Filter panel.
            "fieldName": "quoteStatus",
            "operator": "iEquals",
            "value": "DRAFT"
          },
          "userGroups": ["userGroup1", "userGroup2"] // The above preference type will only be applied if the current user is a member of any of these user groups AND the condition matches.
        },
        {
          "label": "user defined label 2",
          "preferenceType": "MySavedPreference2",
          "userGroups": ["userGroup3"] // No condition set - this preference type applies based on user group membership only.
        },
        {
          "label": "label of the default preference defined by Header Type",
          "preferenceType": "DefaultPreference" // This is the default preference for this header type
        }
      ],
    "customerPicker": [
      ...
    ],
    "customerGroupPicker": [], // For an empty array or undefined property, the global default will be used, in this case CustomerGroupPicker
    "productPicker": [ // The order is important! 
      {
          "label": "Default Product Picker",
          "preferenceType": "productPickerDefaultPreference"
      },
      { // This will be never applied because the first matching type is returned and "Default Product Picker" will always be matching
          "label": "UserGroup specific Product Picker",
          "preferenceType": "productPickerDefaultPreference"
          "userGroups": [ 'Group1', 'Group2' ]
      }
    ],
    "productGroupPicker": [
      ...
    ]
    
  }
}