Start form without start process

Hello to all,
I need to start a process with a form. For example:
request for practice opening, if you do not finalize the request I don’t want that start a process instance.
I would like to show a form first, present in the bpmn, after which the process starts if the user continues after the above-mentioned form.

I noticed that it is possible in the modeler task to start a process with a form. If you put a form key on the startevent, it shows the form, then after clicking on start process you start it, and that’s exactly what I need. How does it work?

Thank you all for your help.

It’s been a few days without a response. It appears that you have a working solution, do you have a specific question?

Well you can get the form and also render it yourself via the forms REST api (/form-api/form/model) then on form submission, start the process with the submitted variables via the process api(/process-api/runtime/process-instances) REST api.

I am struggling with the same problem in REST API. You can get the Process/Case definition and it has field “hasStartForm: true” to tell is if the process/case has start form but so far I have not found any way to get the formKey form the API. Apart from pulling the whole definition XML greppit the test from inside the XML.

Most of the REST API is of no use as it only deals with instance ID’s and prior of starting the process/case there is no instance.

Or am I getting to usage wrong? for case definition has that start form am I supposed to start the case and then render the start form in my UI ? But is’nt that problematic as then engine has already started processing the case without the prerequirement data in the start form ?

As I understand to flow :

  1. get case definition
  2. if definition has start form , get the start form definition(model). HOW do I do that ?
  3. render the start form for user input
  4. submit that data as POST to the case-rutime/instances endpoint with the form values as variables

So, the solution I am using is :

  1. Get the case/process definition form API
    GET cmmn-repository/case-definitions/{caseDefinitionId}
  2. Check if it has “startFormDefined”: true
  3. if it does then get
    GET cmmn-repository/case-definitions/{caseDefinitionId}/resourcedata
  4. from that use regexp to get /<casePlanModel .? formKey="(.?)"/
  5. get the form definition by key
    GET form-repository/form-definitions?key={formKey}
  6. get the actual form definition with fields by id
    GET repository/form-definitions/{formDefinitionId}/resourcedata

Render the form (as Flowable supports external forms a good idea in to use the https://jsonforms.io/
it gives you ready made renderers. And when actually startign the case/process do it normally
POST cmmn-runtime/case-instances
but put the form data into the reguest body variables section:

{
   "caseDefinitionKey":"testCase",
   "businessKey":"myBusinessKey",
   "tenantId": "tenant1",
   "variables": [
      {
        "name":"myVar",
        "value":"This is a variable"
      }
   ]
}

NB: You need to deconstruct the key-value data into {“name”: ${key}, “value”: ${value}} for the variables section.

It doesn’t look like it’s implemented (it is in the custom REST API of Flowable Task, but not as public API). There is a Java API ( FormInfo getStartFormModel(String caseDefinitionId, String caseInstanceId)) that does this, but it doesn’t seem to be exposed over REST.