Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Adobe Summit 2023 [19th to 23rd March, Las Vegas and Virtual] | Complete AEM Session & Lab list

OSGI: Help creating an Adaptive Form Task using Java


Level 7


I am trying to create a task using an Adaptive form, input data, etc. - Just like the Assign Task but, I want to accomplish this via Java API.  The reason is because I need to create a bunch of parallel tasks and the workflow needs to block until they are all completed (don't worry about resolving data conflicts).


I am successfully creating a task using the code below. 

I'm noticing in the CRX that an Assign Task is really a "WorkItem" and not necessarily a Task - let me clarify

I have a custom component that creates a Task.  Immediately, when I check the instance in CRX, the task is in the History node although it's in my Inbox.

If I use the ootb Assign Task, it is uner the WorkItems node.  

I can't find methods to create a workitem or assign information to the task.

I don't know if I need it but, I assume it has something to do with the Task.DEFAULT_TASK_TYPE.

From the jcr, the Assign Task creates a subtype of forms:assigntask.


Anyway, I need some help to mimic the Assign Task feature in Java code.  Is there an API to that service?


Any direction would be helpful.  Thanks.


TaskManagerFactory taskManagerFactory = taskManager.getTaskManagerFactory();

Task task = taskManagerFactory.newTask(Task.DEFAULT_TASK_TYPE);
task.setName("This is the title of the task");
task.setDescription("This is the description of the task");
task.setInstructions("These are the instructions!");
task.setProperty("taskStartDate", new Date());
task.setProperty("taskDueDate", new Date());
task.setProperty("superCustomProperty", "superCustomValue");
List<TaskAction> taskActions = new ArrayList<TaskAction>();



UPDATE: just had an idea - create a component that spawns a bunch of subworkflows that contains the Assign Task. Then, watch them for completion.  Gonna try that for now.

0 Replies