Migrate CSV data to ACF Cascading Select

Migrate CSV data to ACF Cascading Select

 

When switching from third-party system to Jira or JSM you might wonder how to migrate cascading options. We provide scripts to help you to create an ACF Cascading Select field and fill it with exported CSV data. The migration process needs two steps

  • Transform CSV data to the required ACF format

  • Use the data to populate the ACF options

Request the scripts via Jira Service Management

 


Overview

The input CSV represents a hierarchy with several levels — each level is stored in a separate column:

Level 0

Level 1

Level 2

Level 3

Level 0

Level 1

Level 2

Level 3

Undead

 

 

 

 

Ghost

 

 

 

 

Poltergeist

 

 

 

 

Thedworth, Drummer

 

 

 

Bell Witch of Tennessee

 

 

Shadow

 

 

Zombie

 

 

A potential path would be Undead > Ghost > Poltergeist > Drummer of Thedworth.

The script reads each row, builds a nested tree structure, merges duplicate branches, and outputs a clean JSON file.

Example

Raw CSV (input.csv)

Undead,,, ,Ghost,, ,,Poltergeist, ,,,"Thedworth, Drummer" ,,,Bell Witch of Tennessee ,,Shadow, ,Zombie,,

Expected JSON

{ "options": [ { "name": "Undead", "children": [ { "name": "Ghost", "children": [ { "name": "Poltergeist", "children": [ { "name": "Thedworth, Drummer" }, { "name": "Bell Witch of Tennessee" } ] }, { "name": "Shadow" } ] } ] }, { "name": "Zombie" } ] }

Wrong format

These inputs won't work!

Values on several levels

Level 0

Level 1

Level 2

Level 3

Level 0

Level 1

Level 2

Level 3

Undead

the living

 

 

Orphaned options

Level 0

Level 1

Level 2

Level 3

Level 0

Level 1

Level 2

Level 3

Undead

 

 

 

 

 

the living

 

Scripts

This project contains two Python scripts build_cascading_tree.py and acf_options_api.py.

build_cascading_tree.py converts hierarchical data stored in a CSV file into the nested JSON format required by Awesome Custom Fields (ACF) Cascading Select field options API.

acf_options_api.py uses the API to fill the options based on the latest data provided by build_cascading_tree.py.

Details: https://help-seibertmedia.atlassian.net/wiki/x/DYDuDQ

Requirements

You need an .env.webtrigger file and provided data

WEBTRIGGER_URL=https://123456.hello.atlassian-dev.net/x1/123456 WEBTRIGGER_TOKEN=123456 FIELD_ID=customfield_123456 CONFIGURATION_ID=123456

 

Those data can be found in the ACF admin section

image-20251020-200206.png
WEBTRIGGER_URL and WEBTRIGGER_TOKEN

 

image-20251020-200357.png
FIELD_ID

 

image-20251020-200507.png
CONFIGURATION_ID