Hi,
Is there a setting to call an external api when entering the task (or before entering the task(or userTask))? Also send the value of process Instance Id
and form key
?
thanks …
Hi,
Is there a setting to call an external api when entering the task (or before entering the task(or userTask))? Also send the value of process Instance Id
and form key
?
thanks …
Hello @amir133 ,
for user tasks, there are task listeners.
They can be attached on various lifecycle events.
I hope this helps
Jonathan
thanks @jonathan.lukas .
Is it possible to give some examples?
Also how to get process Instance Id
and form key
in there?
may java delegate interface help you
thanks for Answer @Rasim_Savas
I don’t understand how to call an external link.
For example, I want to set, at the beginning of the usertask (or every userTask), XXX.com/get
will be called and its output value will be added to the ‘condidateGroups’ variable.
Please note that my external link written in C# language, and it is located at a different address than Camunda.
Can you help me?
camunda does just node.js and java support. so you need c# program have to write yourself. but this project some action provide for camunda external client.
Here is another helpful collection:
Jonathan
thanks @jonathan.lukas
finally I found my answer , I am using groovy to call my api like this:
<camunda:executionListener event="start">
<camunda:script scriptFormat="groovy">
import groovy.json.JsonSlurper
def formkey = "345435" // need access to formKey!!!!!!!!!!!!!!!!!!!!!
def jsonSlurper = new JsonSlurper().parseText(("https://XXX.com/GetGroupsByFormKey?formKey="+formkey).toURL().text)
//...
</camunda:script>
</camunda:executionListener>
But need access to extensionElements
like processInstaceId
and formKey
. I used these, but no one worked!!!
def formkey = formKey // not worked
def formkey = task.formKey // not worked
def formkey = execution.formKey // not worked
@jonathan.lukas , @Rasim_Savas Do you have any Idea?
Hello @amir133 ,
instead of an ExecutionListener, you can use a taskListener (which is only possible on a user task)
Jonathan
Thanks @jonathan.lukas
So how can I access the value of formKey
and processInstaceId
?
look here, you need DelegateTask or DelegateExecution interfaces. access everything.
Hi @amir133,
If a task listener is used as suggested by @jonathan.lukas then you can access formKey as in below
task.bpmnModelElementInstance.camundaFormKey
Thanks @Rasim_Savas and @hassang