I have this piece of Javascript I’m using from OrgChartJS
var chart = new OrgChart(document.getElementById("tree"), {
nodeBinding: {
field_0: "name"
},
nodes: [
{ id: 1, name: "Amber McKenzie" },
{ id: 2, pid: 1, name: "Ava Field" },
{ id: 3, pid: 1, name: "Peter Stevens" }
]
});
The code as you see it here works great in my app.
To use it with my own data, I have a workflow that generates an array in the format they require, the output looks something like this.
id: 378, pid : 341, name: “Alessia White”, title: “Human Resources Business Partner”, img: “https://xcyd-oosa-mas.n7.xano.io/vault/yHMOBGnw/BFFpNnSj62W4SrRiaj59psk90xM/Fq6EUQ../Alessia+White.jpeg?tpl=med:box”}
If I paste my output direclty into the function, it works. However my output is stored in a Variable or Returned from the Loop generating the data itself, so I need to pass that into the Javascript. I am trying to pass the data stored, but the function will not work. Here is a snippet of code, any idea what I’m doing wrong here?
var chart = new
OrgChart(document.getElementById("tree"), {
mouseScrool: OrgChart.action.none,
nodeBinding: {
field_0: "name",
field_1: "title",
img_0: "img"
},
enableDragDrop: false,
nodes: [
variables['32f4ce59-6bca-4b80-b258-311be2ef78fe']
]
});