Create a request as automation
Using a CORE automation, you can create a request from an existing request.
In order to create an automation to create a request, you will need to switch to script mode.
This article will explain you how you can create a request from an existing request. Using a CORE Automation, it is possible to reuse existing data from your request and create a new one.
In order to do so, create a new Automation and add a new Action of type "Core".
 
Switch to Script mode. You should see the following:
{
  "name": "New automation",
    "on": [
      "responses:completed"
    ],
      "actions": [
        {
          "type": "core",
          "options": {}
        }
      ]
}Change the script to the following one:
{
  "on": [
    "manual"
  ],
  "name": "Create new request",
  "actions": [
    {
      "ref": "new_request",
      "type": "core",
      "result": [
        {
          "type": "link",
          "options": {
            "uri": "https://app.penbox.io/{$company.attributes.slug}?id={$output.id}"
          }
        }
      ],
      "options": {
        "data": {
          "type": "requests",
          "attributes": {
            "data": "{ data }",
            "user": "{ user }",
            "active_from": null
          },
          "relationships": {
            "owner": "{ $request.relationships.owner }",
            "flow_customization": {
              "data": {
                "id": "039a0bb7-a8dd-4e57-8b29-bd72f94094c1",
                "type": "flow_customizations"
              }
            }
          }
        },
        "action": "create",
        "continue-on-error": true
      }
    }
  ]
}Where flow_customization.id is the uuid of the form preset you want to use.
This payload will:
- Create a new request using the form preset 039a0bb7-a8dd-4e57-8b29-bd72f94094c1
- Assign the same owner as the owner of the current request
- Redirect the user to the newly created request
- Prefill the request with the same information from dataanduseras the current request.
The form template ID can be found when visting this page and extracting the URL:
 
Example:
https://app.penbox.io/my-workspace/customizations/1ef53402-d1c8-61b0-581a-b1427cfe333bThe uuid is the id at the end of the URL.
Updated 5 months ago