Create a cutom module record using a custom route

I’m new to using Corteza and I’m currently trying to navigate through creating a record on a custom module via a custom route that I’ve set up. Thankfully, the route seems to be operational. However, I’m hitting a roadblock when it comes to parsing the data sent to the route and utilizing it to initiate a secondary action in the workflow.

As it stands, the workflow gets triggered when the route is activated, but that’s the extent of my success so far. My uncertainty lies in how to correctly pass data to the route—whether it should be through query parameters, in a specific format, or within the body. Moreover, I’m not quite sure how to then parse this data to create a record.

I’ve been diligently reading through the documentation, but I’m struggling to connect all the dots. Any guidance, tips, or insights from those more experienced with Corteza would be immensely appreciated. Your expertise could really help a beginner out!

Thanks in advance for your time and help.

So you want to achieve this?

  1. On route activate wf
  2. Wf creates a record based on params

If so, try to read through this (if you haven’t already)
https://docs.cortezaproject.org/corteza-docs/2023.9/integrator-guide/automation/workflows/examples/index.html#_parse_integration_gateway_request

1 Like

Thanks for the help. I did read that, and it helped immensely. I got confused by several posts earlier this year that had pulled some magic variables in from a trigger. Finally got it working though. Here is my config for reference should someone find a similar problem.

{
  "workflows": [
    {
      "handle": "",
      "enabled": true,
      "meta": {
        "name": "Sample API",
        "description": "",
        "visual": null
      },
      "keepSessions": 0,
      "steps": [
        {
          "stepID": "4",
          "kind": "termination",
          "ref": "",
          "arguments": null,
          "results": null,
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "4",
              "parent": "1",
              "value": "Finish",
              "xywh": [
                3720,
                2280,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "17",
          "kind": "function",
          "ref": "apigwBodyRead",
          "arguments": [
            {
              "target": "request",
              "expr": "request",
              "type": "HttpRequest"
            }
          ],
          "results": [
            {
              "target": "bodyContents",
              "expr": "body",
              "type": "String"
            }
          ],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "17",
              "parent": "1",
              "value": "Read request body",
              "xywh": [
                2520,
                2280,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "24",
          "kind": "function",
          "ref": "logWarn",
          "arguments": [
            {
              "target": "message",
              "value": "Body contents in KV following",
              "type": "String"
            },
            {
              "target": "fields",
              "expr": "data",
              "type": "KV"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "24",
              "parent": "1",
              "value": "Output variable",
              "xywh": [
                3000,
                2280,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "27",
          "kind": "expressions",
          "ref": "",
          "arguments": [
            {
              "target": "data",
              "expr": "bodyContents",
              "type": "KV"
            }
          ],
          "results": null,
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "27",
              "parent": "1",
              "value": "Assign body to variable",
              "xywh": [
                2760,
                2280,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "35",
          "kind": "expressions",
          "ref": "",
          "arguments": [
            {
              "target": "data1",
              "expr": "data.data1",
              "type": "Any"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "35",
              "parent": "1",
              "value": "Assign json to variables",
              "xywh": [
                3240,
                2280,
                200,
                80
              ]
            }
          }
        },
        {
          "stepID": "36",
          "kind": "function",
          "ref": "emailSend",
          "arguments": [
            {
              "target": "subject",
              "value": "Test",
              "type": "String"
            },
            {
              "target": "replyTo",
              "value": "email@email.com",
              "type": "String"
            },
            {
              "target": "from",
              "value": "email@email.com",
              "type": "String"
            },
            {
              "target": "to",
              "value": "email@email.com",
              "type": "String"
            },
            {
              "target": "html",
              "expr": "data1",
              "type": "String"
            }
          ],
          "results": [],
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "defaultName": false,
              "id": "36",
              "parent": "1",
              "value": "Email results",
              "xywh": [
                3480,
                2280,
                200,
                80
              ]
            }
          }
        }
      ],
      "paths": [
        {
          "parentID": "17",
          "childID": "27",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "32",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "27",
          "childID": "24",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "33",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "24",
          "childID": "35",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "34",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "35",
          "childID": "36",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "37",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        },
        {
          "parentID": "36",
          "childID": "4",
          "meta": {
            "name": "",
            "description": "",
            "visual": {
              "id": "38",
              "parent": "1",
              "points": [],
              "style": "exitX=1;exitY=0.5;exitDx=0;exitDy=0;entryX=0;entryY=0.5;entryDx=0;entryDy=0;",
              "value": null
            }
          }
        }
      ]
    }
  ]
}