Expand my Community achievements bar.

get the process id from a custom component

Avatar

Level 6
Hello,



Anyone knows how to get the process id from a custom component?



thank you
9 Replies

Avatar

Level 10
This doesn't make sense.



A process id related to the overall process (one instance of the process) and not to a particular step in the process.



Can you elaborate more on what you're trying to do?



Jasmin

Avatar

Level 6
Jasmin,



Im trying to get a value from a process variable.



Thank you

Avatar

Level 10
I still don't understand what you're trying to do?



From where are you trying to get the value of the process variable?



Jasmin

Avatar

Level 6
Jasmin,



I want to transform the value of a variable based on a user input(here the user is the person that will design the process), however I want to make that transformation invisible to the user (ex: change a text or make some calculations). So, the idea would be to encapsulate this transformations inside a custom component. This component would have an input field where the user would place some value. Then the component would take that value and the value of a previous variable defined in the process, and change it.



I think there are some methods (get Process Variable Values) to get the value of the variables in the process, but because the same process can run multiple instances at the same time, I believe I need the process id (or taskid?) of the current context of the component.



got it?



thank you

Avatar

Level 10
You don't need any context.



When you execute an instance of the process, your custom component will give you the value of the varibale for that instance only.



Jasmin

Avatar

Level 6
Jasmin,



The point is how can I access to the value of a process variable in the Java code of my custom component.



thank you

Avatar

Level 10
You can use the TaskManager API to get the value of a process variable for a specific process id. Here is a snipped of code:



_queryManager = TaskManagerClientFactory.getQueryManager(_factory);

procVar = _queryManager.getProcessVariableValues(processID);



int size = procVar.size();

for(int i = 0; i < size; i++)

{

MultiTypeVariable var = ((MultiTypeVariable)procVar.get(i));

System.out.println("name = " + var.getName());

System.out.println("value = " + var.getValue());

}



Jasmin

Avatar

Level 6
Jasmin,



But from my java code in the custom component, where processID and _factory come form? If they are not explicity declared I will get a compile error. Sorry if I´m not seeing a obvious step.



thank you

Avatar

Level 10
I told you this was a just snippet of code.



You can create a input parameter to your component and pass the /process_data/@id process varibale to it. It's a built in variable that contains the process id.



There's a ton of exmaples in the documentation online on how to create a factory object.

See http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000274.html and http://livedocs.adobe.com/livecycle/8.2/programLC/programmer/help/000008.html



Jasmin