Creating a new request as manual action

In Penbox, it is possible to create a new request as a manual action from an existing request. You are then able to reuse data capture from the initial request in the next request.

You will be able to create an action when viewing a request directly from the app.

In order to do so, this will require a bit of script mode.

Creating the automation

In the studio, go in Automations and add a new automation. Select Manual as trigger and add a core action.

It should look like something like this:

Referencing the form template and the prefilled data

Switch to script mode (top right of the studio) and use this code:

[
  {
    "on": [
      "manual"
    ],
    "name": "Create follow-up",
    "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 }", // You can do some custom mapping if you want
              "user": "{ user }",
              "active_from": null // It means the request will be created as draft
            },
            "relationships": {
              "owner": "{ $request.relationships.owner }", // The owner of the request will be the same as the owner of the initial request
              "flow_customization": {
                "data": {
                  "id": "039a0bb7-a8dd-4e57-8b29-bd72f94094c1", // Replace with the ID of the new form (can be extracted from URL) 
                  "type": "flow_customizations"
                }
              }
            }
          },
          "action": "create",
          "continue-on-error": true
        }
      }
    ]
  }
]

🚧

Do not forget to remove the comments (everything after // ) to make sure the code does not generate an error.

Make sure to use the ID from the URL in the customisation of your form template and not from the studio!