Workflow UserTask set DueDate
In our task user form, the user sets the due date of the request. This is the date the user wants the request to be resolved.
How can we do to set the task due date with this value instead of the automatic calculation that Collibra does?
We are working with the Workflow Designer
Elvira Brusa
Posted 3 years ago · Edited 1 year ago·Last reply 8 months ago
3 comments
George Cheung
·8 months agoimport java.text.SimpleDateFormat; simpleDateGMT = new SimpleDateFormat("yyyy/MM/dd") simpleDateGMT.setTimeZone(TimeZone.getTimeZone("GMT")) selectDateFormatted = simpleDateGMT.format(selectDate) simpleDateLocal = new SimpleDateFormat("yyyy/MM/dd") selectDateParsed = simpleDateLocal.parse(selectDateFormatted) def nowTimeStamp = new Date().getTime() def differenceInSec = ((selectDateParsed.getTime() - nowTimeStamp)/1000).round() execution.setVariable('UserTaskDueDate',"PT${differenceInSec}S".toString())This is the code that I used to set the user task due date to a date from a datepicker. The variable selectDate is the form for the date selection of a future date and the user task has the ModelId: UserTask. The script is getting the amount of seconds between the selected date and the current time, and setting the due date to that date based on duration.
stefan_busch
·3 years ago · EditedHi,
you can just overwrite the variable that stores the due date before in a script task that comes before the user task for which you want to change the due date.
The code you need looks like the following
where you would need to exchange formTask1DueDate with the the corresponding form task due data variable (you find them in the settings of the workflow in Collibra) and B2M with the expression for the due date that the user selected.
Justin Truehitt
·1 year agoHow can you accomplish this if you want to inject a hard date versus using ISO duration notation?