Highlighted

get the process id from a custom component

neptas

08-01-2009

Hello,



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



thank you

Replies

Highlighted

Jasmin_Charbonn

09-01-2009

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
Highlighted

Jasmin_Charbonn

09-01-2009

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
Highlighted

neptas

09-01-2009

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
Highlighted

Jasmin_Charbonn

12-01-2009

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
Highlighted

neptas

13-01-2009

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
Highlighted

Jasmin_Charbonn

13-01-2009

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
Highlighted

neptas

15-01-2009

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
Highlighted

Jasmin_Charbonn

16-01-2009

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