cancel
Showing results for 
Search instead for 
Did you mean: 

Show due dates from Tasks in calendar

atoyos
Champ on-the-rise
Champ on-the-rise

Hi! I need to create a task that requires to complete a doc, with a due date.

But that due date should be added to the calendar automatically.

Is there any way to do that?

Thanks!!

1 ACCEPTED ANSWER

atoyos
Champ on-the-rise
Champ on-the-rise

Hi! I finally found the solution:

I added this xml:


<bean id="my.activitiBeanRegistry" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="activitiBeanRegistry">
<property name="targetObject">
<ref bean="activitiBeanRegistry" />
</property>
<property name="targetMethod" value="put" />
<property name="arguments">
<list>
<value>workflowTaskListener</value>
<ref bean="workflowTaskListener" />
</list>
</property>
</bean>

<bean id="workflowTaskListener" class="com.someco.bpmn.WorkflowTaskListener" parent="activitiCreateTaskListener"/>

</beans>

Where WorkflowTaskListener is my new Listener.

Thanks all!

View answer in original post

8 REPLIES 8

sanjaybandhaniya
Elite Collaborator
Elite Collaborator

There is no default way to add this.

You need some customization to add calendar entry on workflow start.

Could you give me some example for add calendar event? 
I've looking how to add an event listener in the workflow but I'm not sure if it has to be javascript or java code.

Thanks!

You need to use CalendarService to add entry.

You can use server side javascript code also.

Ref : https://stackoverflow.com/questions/64459998/alfresco-calendar-event-using-server-side-javascript

Hi! Now i'm trying to add a listener implemented with java, but I can't make it work.

If I put like this: 

 <userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
      <extensionElements>
        <activiti:taskListener event="create"  delegateExpression="${workflowTaskListener}"/>
      </extensionElements>
    </userTask>

And I added @Component annotation to the WorkflowTaskListener class.

Also tried to define the bean in service-context.xml like this:

<bean id="workflowTaskListener" class="com.someco.bpmn.WorkflowTaskListener" />

so I have this error:

Caused by: org.activiti.engine.ActivitiException: Unknown property used in expression: ${workflowTaskListener}
	at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:53)
	at org.activiti.engine.impl.bpmn.listener.DelegateExpressionTaskListener.notify(DelegateExpressionTaskListener.java:44)
	at org.activiti.engine.impl.delegate.TaskListenerInvocation.invoke(TaskListenerInvocation.java:34)
	at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
	at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
	at org.activiti.engine.impl.persistence.entity.TaskEntity.fireEvent(TaskEntity.java:740)
	... 243 more
Caused by: org.activiti.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'workflowTaskListener'
	at org.activiti.engine.impl.juel.AstIdentifier.eval(AstIdentifier.java:83)
	at org.activiti.engine.impl.juel.AstEval.eval(AstEval.java:50)
	at org.activiti.engine.impl.juel.AstNode.getValue(AstNode.java:26)
	at org.activiti.engine.impl.juel.TreeValueExpression.getValue(TreeValueExpression.java:114)
	at org.activiti.engine.impl.delegate.ExpressionGetInvocation.invoke(ExpressionGetInvocation.java:33)
	at org.activiti.engine.impl.delegate.DelegateInvocation.proceed(DelegateInvocation.java:37)
	at org.activiti.engine.impl.delegate.DefaultDelegateInterceptor.handleInvocation(DefaultDelegateInterceptor.java:25)
	at org.activiti.engine.impl.el.JuelExpression.getValue(JuelExpression.java:50)
	... 248 more

  

And if I define the taskListener like this:

<userTask id="alfrescoUsertask1" name="Alfresco User Task" activiti:assignee="${initiator.properties.userName}" activiti:formKey="wf:activitiReviewTask">
<extensionElements>
<activiti:taskListener event="create" class="com.seco.bpmn.WorkFlowTaskListener"/>
</extensionElements>
</userTask>

It gives me an NullPointer error in the listener class because I want to autowire a Service:

public class WorkflowTaskListener implements TaskListener {

private static final Log logger = LogFactory.getLog(WorkflowTaskListener.class);

@Autowired
private CalendarService calendarService;

Aclaration: I'm working with project created with maven sdk alfresco.

Please help, I don't know what else to try.

Thanks!!

atoyos
Champ on-the-rise
Champ on-the-rise

Hi! I finally found the solution:

I added this xml:


<bean id="my.activitiBeanRegistry" class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" depends-on="activitiBeanRegistry">
<property name="targetObject">
<ref bean="activitiBeanRegistry" />
</property>
<property name="targetMethod" value="put" />
<property name="arguments">
<list>
<value>workflowTaskListener</value>
<ref bean="workflowTaskListener" />
</list>
</property>
</bean>

<bean id="workflowTaskListener" class="com.someco.bpmn.WorkflowTaskListener" parent="activitiCreateTaskListener"/>

</beans>

Where WorkflowTaskListener is my new Listener.

Thanks all!

Merdemerey
Champ in-the-making
Champ in-the-making

About showing due dates from Tasks in your calendar—I get why that's super handy. It's like having everything in one place, right?

halenabob
Champ in-the-making
Champ in-the-making

Yes, that is possible to create a task that requires the doc with an automatically added due date on the calendar. Many professional or project management tools are free you can easily use them, To avoid and don't miss any deadlines when you create a task it will automatically appear in your calendar. Additionally, you can utilize online resources, for example, students using nursing assignment help to solve their educational encumbrances, same as you can create tasks easily and won't miss any due dates. 

tompaulson
Champ in-the-making
Champ in-the-making

Absolutely agree with you!