Expand my Community achievements bar.

How to get ProcessInstanceId after Workflow KickOff. Am able to get the InvocationId

Avatar

Former Community Member
How to get ProcessInstanceId after Workflow KickOff. Am able to get the InvocationId.



***************************************************************************



This is the Snippet :

*********************



InvocationResponse response = myServiceClient.invoke(request);

invocationId = response.getInvocationId();

System.out.println("ClientParams="+response.getClientParameters());

System.out.println("OutputParams="+response.getOutputParameters());

System.out.println("invocationId="+invocationId);

JobManager jobManager = new JobManager(myFactory);

JobStatus jobStatus = null;



JobId myJobId = new JobId(invocationId);





jobStatus = jobManager.getStatus(myJobId);

System.out.println("Job Status: " + jobStatus.getStatusCode());



if (jobStatus.getStatusCode()==JobStatus.JOB_STATUS_COMPLETED)

{

System.out.println("INVOCATION COMPLETED SUCCESSFULLY!");

InvocationResponse jobResponse = jobManager.getResponse(myJobId);

jobManager.terminateJob(myJobId);

jobResponse.getInvocationId();



}



***************************************************************************



Process id need to be fetched after Workflow Kickoff



Can anyone please help me..?
6 Replies

Avatar

Level 10
What about if you store the process instance id in a process variable and make sure the variable is of type "output".



That way it'll be as part of the InvocationResponse. You can use the getOutputParameter to get the value of the variable.



Jasmin

Avatar

Former Community Member
Hi Jasmin,



Thanks for ur reply. We are not clear as of how to Store the Process Instance Id while a process is getting invoked. Can u give a sample snippet of how we can do it.



Saravanan

Avatar

Level 10
There are 5 process level variables that get populated when you invoke a process. They are



/process_data/create_time

/process_data/creator_id

/process_data/id

/process_data/status

/process_data/update_time



Within the xPath builder you can differentiate them from other process variable because they are italicized.



Now you can create your own process variable - let's say called pid - and have it contain the process id which is stored in /process_data/id.



The xPath would look something like

/process_data/@pid = /process_data/@id



If the pid variable is marked as an 'output' variable, then it will be returned as part of the InvocationResponse.



Jasmin

Avatar

Former Community Member
Hi Jasmin,

We tried the same way exactly as u have suggested in ur last reply - But we r getting the 'pid' as null.



We declared the output variable 'pid' as of String datatype and as 'Output' variable.



Can we have ur contact number and ur expected time of cal - for ur assistance in our work as we are in a critical situation here.



Thanks,

Sara (+91 9843826703)

Avatar

Level 10
Make sure your process is long lived.



Right click on the name of your process (from Processes) then under Properties/Advanced.



Jasmin

Avatar

Former Community Member
Hi Jasmin,



I am new in Adobe LiveCycle. Can u please help me with the following problem stepwise?



For example, say I have invoked a process from the java end by using invoke() method. I need to have the Process Id of the process (just created) FROM MY JAVA END along with the task id that has been generated. I can see those values in the 'adminui'. But I need to have them in my Java End.



Can you please help me with the piece of code?



Thanks in advance,

Arnab