Show due dates from Tasks in calendar

cancel
Showing results for 
Search instead for 
Did you mean: 
atoyos
Active Member

Show due dates from Tasks in calendar

Jump to solution

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 Solution

Accepted Solutions
atoyos
Active Member

Re: Show due dates from Tasks in calendar

Jump to solution

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 solution in original post

5 Replies
sanjaybandhniya
Intermediate

Re: Show due dates from Tasks in calendar

Jump to solution

There is no default way to add this.

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

atoyos
Active Member

Re: Show due dates from Tasks in calendar

Jump to solution

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!

sanjaybandhniya
Intermediate

Re: Show due dates from Tasks in calendar

Jump to solution

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

atoyos
Active Member

Re: Show due dates from Tasks in calendar

Jump to solution

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
Active Member

Re: Show due dates from Tasks in calendar

Jump to solution

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!