Trigger process instance

Hello all,
since I am new to Camunda and generally in the process automation field, I would like to know how a process instance can be triggered once for example a user submits a request. In the last process automation live forum, Benjamin Hoffman presented a demo that when the user submits (sends) an account application, in the backend a process instance is generated. What do I need to make so as to connect my website and the workflow engine in order to make the first step to process automation?
Any answers would be so helpful for me since I need a starting guidance to get an insight on it.

Thank you all in advance.

I paste also the link to the aforementioned demo:

Hi @nikolaosnousias,

the example I showed makes a call to Camunda’s REST API endpoint that is described here:

https://docs.camunda.org/manual/7.13/reference/rest/process-definition/post-start-process-instance/

So it’s basically some JS code doing a POST request in the web page that does the trick.

I hope this helps. If not, let me know!

Best,
Ben

1 Like

Hi Ben,

thanks for your reply.

As I mentioned, I am not a technical developer but a finance analyst, so it is somehow very complicated to grasp the logic behind it. I have two questions.
First of all, when we do a POST request we don’t need to specify the endpoint? Because in the documention that you attached, there is no any code line that is linked to the endpoint.

And my second question is if you could provide this block of code that you did the POST request so I can see exactly what the logic is behind it. If you could do so, I would really appreciate it ot if you could provide me a similar block of code from another example.

Thanks for your time. I really appreciate it.

There is indeed an end point required.
In that document that ben posted there’s an example that shows the end point and the payload

POST /process-definition/key/aProcessDefinitionKey/start


{
  "variables": {
    "aVariable" : {
        "value" : "aStringValue",
        "type": "String"
    },
    "anotherVariable" : {
      "value" : true,
      "type": "Boolean"
    }
  },
 "businessKey" : "myBusinessKey"
}
1 Like

Thanks for the assistance Niall.
I appreciate it.

Hey @benhoffmann,

I just tried to do the trick with the JavaScript code so as to make a post request in the engine endpoint, but I have an issue. I attach an image with the error that appears in my console. Any ideas about how to fix it? Is it an issue from Camunda’s rest api?

Thank you in advance.

img

@nikolaosnousias this is CORS(Cross-origin resource sharing) related issue. By adding the below code will resolve the issue:

Hey @aravindhrs,

since I don’t have that technical knowledge, can you indicate where I can paste the code that you provided?? This is code written in java, but can I paste it in my website’s javascript code??

Thank you in advance.

@nikolaosnousias are you using camunda spring boot setup or tomcat distribution?

@aravindhrs Currently we are trying Enterprise edition (Wildfly), but we use also community edition (tomcat).

Refer this post for adding cors settings to wildfly:

@aravindhrs Thanks for your patience and you willingness to help me. Now I get another error. Still I can’t make it work. Any ideas??
113