BPMN - Service Task - access to process ID

568 views
Skip to first unread message

francisco boato

unread,
Jan 19, 2022, 6:09:39 AM1/19/22
to Kogito development mailing list
Hi, i would like to know if there is any way of getting the process instance id "from inside" a Service task?
  This service task should invoke an external rest service, and the process id should be passed inside the body of the external rest call.

Francisco

Cristiano Nicolai

unread,
Jan 19, 2022, 10:26:31 PM1/19/22
to Kogito development mailing list
Hi Francisco,

You can add a parameter of type ( KogitoProcessContext context ) to your method, which Kogito will automatically resolve. From there simply use context.getProcessInstance().getStringId() to retrieve the process instance id.
I'll add a note in the docs about this.


--
You received this message because you are subscribed to the Google Groups "Kogito development mailing list" group.
To unsubscribe from this group and stop receiving emails from it, send an email to kogito-developm...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/kogito-development/6c53b2fc-e676-4940-a9ea-3094d8632c9bn%40googlegroups.com.


--
Best regards,

Cristiano Nicolai

Pawan Saha

unread,
Mar 23, 2025, 6:32:02 AM3/23/25
to Kogito development mailing list

Hi Cristiano,

In the afterVariableChanged listener within The Listener, is there a way to access the context? It seems we cannot add a parameter of type KogitoProcessContext context to the listener.

Looking forward to your guidance.

Regards,
Pawan

Reply all
Reply to author
Forward
0 new messages