• timer or due date in workflow

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #43021  by jimac
 
I am using JBPM 3.3.1 GA
Jboss 5.00

Good Day!

I am planning on doing this, but I don't know how.

user 1 will input the date or time, then that inputted time/date will be the basis for notifyng user2.
For example:

Due Date : 5:00pm (user 1 inputted 5pm)
submit

user 2 will see a blinking icon ( pending task ) on 5:00pm
not when user 1 click submit.
-
THUS, I need a dynamic due date

But I dont know how to set a variable in "<timer duedate="(i need to put a variable here)"
Thanks!
 #43032  by pavila
 
The simplest approach to set the timer due date dynamically during process execution would be to use a process variable. This variable could be set in an ActionHandler, before the node containing the timer is reached:
Code: Select all
public class SetDueDateActionHandler implements ActionHandler {
  public void execute(ExecutionContext executionContext) throws Exception {
    Date duedate = new Date();
    // apply some date calculations
    executionContext.setVariable("calculatedDueDate", duedate);
  }
}
This variable can then be used in the duedate attribute in processdefinition.xml, using the following syntax:
Code: Select all
<timer duedate="#{calculatedDueDate}" name="mytimer">
<timer duedate="#{calculatedDueDate} + 5 days" name="mytimer">
The variable in the 'duedate' attribute (here: #{calculatedDueDate}) has to be either a java.util.Date or java.util.Calendar object.
 #43035  by jimac
 
pavila wrote:The simplest approach to set the timer due date dynamically during process execution would be to use a process variable. This variable could be set in an ActionHandler, before the node containing the timer is reached:
Code: Select all
public class SetDueDateActionHandler implements ActionHandler {
  public void execute(ExecutionContext executionContext) throws Exception {
    Date duedate = new Date();
    // apply some date calculations
    executionContext.setVariable("calculatedDueDate", duedate);
  }
}
This variable can then be used in the duedate attribute in processdefinition.xml, using the following syntax:
Code: Select all
<timer duedate="#{calculatedDueDate}" name="mytimer">
<timer duedate="#{calculatedDueDate} + 5 days" name="mytimer">
The variable in the 'duedate' attribute (here: #{calculatedDueDate}) has to be either a java.util.Date or java.util.Calendar object.
Hello,

This is my code:
Code: Select all
package com.sample.action;

import java.util.Date;
import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;
import com.openkm.bean.form.Input;

public class timer_duedate implements ActionHandler {
	private static final long serialVersionUID = 1L;

	@Override
	public void execute(ExecutionContext context) throws Exception {
		// input for user
		Input calculatedDueDate = (Input) context.getContextInstance().getVariable("calculatedDueDate");
		String inputted_calculatedDueDate = calculatedDueDate.getValue(); 

		 Date duedate = new Date();
		 // apply some date calculations
		 context.setVariable("inputted_calculatedDueDate", duedate);
	}
 }
The variable " inputted_calculatedDueDate" says that it is not used.

Can you correct my code ?

also,
what format should the user input for it to accept the date? ,
does this kind of format accepted?
year-month-day (2016-January-19)

or can it also accept hours only?
like
1 hour
2:45pm

something like that.
Thanks

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.