Expand my Community achievements bar.

Dive into Adobe Summit 2024! Explore curated list of AEM sessions & labs, register, connect with experts, ask questions, engage, and share insights. Don't miss the excitement.

Process Instance : Update Process Variables with Java API

Avatar

Level 1

Hi,

I need to set a lot of process variables in a java service that is executed in a process but can't find the way to do that.

Is it possible to modify the value of a variable from a process instance with the JAVA API ?

I didn't find this type of function (for example with the ProcessManager API).

Thanks,

Will

5 Replies

Avatar

Employee

Will,

Can you be more specific? Do you mean that you want to manipulate process variable values while the LC process is running? So you could arbitrarily "poke" values into a running process?

Marcel

Avatar

Level 1

I need to create a specific service that will be connected to different systems to get some external informations.

Those informations must be put in my process variables.

This service will be executed in a Livecycle Process.

I need to set a lot of process variables (like 100 vars) and I didn't find any function in the Java API to set process instance variables.

The SetValue Service is not a good solution because there is to much variables to set and my specific service will not always set the same variables (it must set them dynamically. It's a too complex algorithm to set the values in the process modelling. I need to set them programaticly.

Will

Avatar

Level 5

Could you place your logic in an executeScript service?

You can use native Java there.

I have had good luck getting values in and out of process varaibles with the get... set...

this is a very simple example.

import com.adobe.workflow.pat.service.*;
String allowLogging = patExecContext.getProcessDataStringValue("/process_data/@allowLogging");

patExecContext.setProcessDataStringValue("/process_data/@errorActivity", "Save Doc XML");
patExecContext.setProcessDataStringValue("/process_data/@errorMessage", "SystemException");

if (allowLogging.equalsIgnoreCase("true")) {
System.out.println("@@@@ Save Doc XML @@@@");
System.out.println("@@@@ SystemException @@@@");

}; // END allowLogging

Avatar

Level 1

Maybe that will be the solution....I will try.

But the problem is that all my logic is defined on a specific service wich use a lot a stuff (EJB3, Hibernate, ....) and I don't think that I could put all those things on an executeScript service....

Avatar

Level 9

Hi Will

I'm pretty sure we could build a component to allow you to do this from your Java code.

If you're interested, please email info@avoka.com

Howard