strategy node creator

by Laurel Bruggeman

HTML

<textarea id="result" style="height: 600px; width: 600px"></textarea>

JavaScript

let iteration = 0;

function getNext(index) {
  iteration++;
  if(iteration < 150) {
    return `"nextEdge": { "id": ${index}, "type": "generic_edge"},
    "next": {"type": "hosted_email_spark_post", "label":"Email", "id":${index+1}, "configurationState": "unconfigured", ${getNext(index+2)}} `
   }
   return `"next": null, "nextEdge": null`;
}

function rootNode() {
 var start = 50;
  return `{ 
  "id": "94e74f69-8929-46eb-8b15-f182f1aa62d4",
  "strategyId": "945694f2-bddc-40dd-b0a0-417f8998b150",
  "name": "New Workflow",
  "nextId": ${start},
  "funnelStageType": "VISITORS",
      "rootNode": { 
        "id": 2,
        "type": "entry_point",
        "label": "Entry point222",
        "nextEdge": null,
        "next": null,
        "configurationState": "unconfigured",
        "routes": [],
        "routeEdges": [],
        "routes":[],
        ${getNext(start+1)}
      }
    }`
}

document.getElementById('result').value = rootNode();