Expand my Community achievements bar.

Getting User-Assigned-Task Variables

Avatar

Level 3

Hi,

I have a task assigned to a user, I am trying to obtain, through an execute script, the process variables of this task. Unfortunately I keep getting an exception in one of the internal classes of LiveCycle. I'm not sure what I'm doing wrong.

Here's the code that I am using (I am using the context of the same user that has the task assigned to):

     ServiceClientFactory userFactory = ServiceClientFactory.createInstance(InvocationContext.getInstance().getContext());
     TypedTaskManagerQueryService tmqs = new TypedTaskManagerQueryService(userFactory);
     List processVariableValues = tmqs.getProcessVariableValues(taskID);

And here's the exception (I cut out a long part of it to make it clearer), it occurs on the getProcessVariableValues method in my code:

     com.adobe.pof.UnknownValueException: Attribute: workflow_principal_id on object: queue:[1] has not been loaded.
          at com.adobe.pof.DefaultGenericObject.getValue(DefaultGenericObject.java:90)
          at com.adobe.workflow.boi.BOIQueueBase.getWorkflowPrincipalId(BOIQueueBase.java:285)
          at com.adobe.idp.taskmanager.dsc.queryservice.TaskManagerQueryServiceImpl.getProcessVariableValues(TaskManagerQueryServiceImpl.java:160)
          at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
          at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

          at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

Any insight is greatly appreciated! Thanks

Nic

4 Replies

Avatar

Level 3

I'm still trying to figure out how to solve this. I thought perhaps if there was a way of setting the workflow_principal_id but I don't have any idea what that is exactly. Anybody noticing anything wrong in my code?

Thanks

Nic

Avatar

Level 10

"obtaining process variables of this task"??  What do you mean by this statement??

All process variables are accessible by all the tasks within a process instance.

If you are trying to access the process variables within your process, there is no need to use an ExecuteScript activity; Instead you can use SetValue.

If you still wish to use ExecuteScript, there is no need to instantiate ServiceClientFactory. Since your ExecuteScript activity is being run within the process context, you can just use the following statement to get the variable values:

Is that make sense?

Nith

Avatar

Level 3

I should have specified that I want to do this from another process. With the code I provided, I should be able to retrieve variables from any process, granted that I have right to that process instance.

I apologize for not using the correct terminology, I get confused between a task and a process instance. A task is when a process instance gets assigned to a user, ie: when using an assign task activity?

Thanks

Nic

Avatar

Level 3

Apparently this would be a bug in the version of the server that I am using.

Version: 8.2.1, GM
Patch Version: SP3
Service Pack Version: 8.2.3163.3.212556.2

Nic