General App Documentation
Breadcrumbs

Cascading Select for CFOS


Description

The cascading select allows you to display select values which are categorised by the parent value. With the Custom Field Option Synchroniser you can retrieve both the parent and child values from your custom database tables.


Example

This is a simple example that shows how to use the Custom Field Option Synchroniser in a combination with the cascading select.

Both tables in this example contain the only necessary columns which are required for the cascading select.


Parent table

Definition

SQL
CREATE TABLE `my_foo_parent` (
  `id` int(11) NOT NULL,
  `value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin


Data

Screen Shot 2016-12-07 at 10.21.42.png


Child table

Definition

SQL
CREATE TABLE `my_foo_child` (
  `id` int(11) NOT NULL,
  `parentid` int(11) NOT NULL,
  `value` varchar(255) COLLATE utf8_bin DEFAULT NULL,
  PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_bin

Parentid can be a column directly on the child table or the value can later be retrieved with joins though it normally should be a 1 to m relationship where the foreign key is in the child table. There is no need though to actually define a foreign key.

If there is no connection in the database on the table you need to define a mapping table for the parent-child relationship and join the mapping table in the child query.


Data

Screen Shot 2016-12-07 at 10.21.20.png


Custom field sync configuration

Screen Shot 2016-12-07 at 10.28.23.png


Custom field

Definition

Screen Shot 2016-12-07 at 10.28.08.png

After a sync the custom field which you defined in the sync configuration is populated with the following values.


Ticket view

Each parent has as options only the children as child values.

Screen Shot 2016-12-07 at 10.30.26.png
Screen Shot 2016-12-07 at 10.30.35.png
Screen Shot 2016-12-07 at 10.30.44.png