I have 2 custom date fields (start and end time).
I want to calculate the difference between them.
The difference has to be greater than 4hours.
This will be set in a workflow as a condition/validation when creating an issue.
Working in jira 4.2, standalone version
Downloaded and installed a lot of plugins, none give me the result i wanted
(1 of my conditions if end time has to be larger or equal than begintime)
Hi,
I think that you can do this by adding a condition to the transition using one of the scripting utilities plugin like script runner or jjupin, jss.. or develop you own plugin.
Look to this links its can help you and give you more ideas.
https://marketplace.atlassian.com/plugins/com.onresolve.jira.groovy.groovyrunnerhttps://marketplace.atlassian.com/plugins/com.quisapps.jira.jsshttps://marketplace.atlassian.com/plugins/com.keplerrominfo.jira.plugins.jjupin
In our company, we use JJUPIN to do like what do you need.
I'm testing some script writers.
JJupin will be the best, except ..
https://answers.atlassian.com/questions/282630/jjupin-cursor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
try this code as a condition in yur transition workflow
replace sDate with your custom field start date and eDate with your customfield end date
date #{sDate} ="2014-04-10 12:00:00";// start date time date #{eDate}="2014-04-10 16:30:00";//end date time number #{diffTime}=0; while(#{sDate}<#{eDate}){ #{sDate}=#{sDate}+"1h"; #{diffTime}=#{diffTime}+1; } if(#{diffTime}>4){ return true; } else{ return false; }
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Put it as validator when creating an issue
Script workflow function : Simple scripted validator : Checks script
i get always the error message :s
Timedifference between the 2 has to be at least 4 hours.
So if startdate is today at noon and enddate is tomorrow at noon, it's ok.
But it's a good start ty.
What are the possible languages to write the script in?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
jjupin is a paid plugin but it's very easy to work with it (don't have knowledge in java language)
groovy and jss are free plugins but it's hard to work with it, ithink that you must have some knowledge in java or python languages
If this answer or other answers to your questions have helped you, please can you accept answers to help other who has the same problems
good luck
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Even when the script is - in the simple script validator-:
Script workflow function : Simple scripted validator : Checks script:
date sDate = cfValues['Start time'];// start date time date eDate = cfValues['End time'];//end date time number diffTime=0; /*while(sDate<eDate){ sDate=sDate+"1h"; diffTime=diffTime+1; }*/ return true; /*if(diffTime>4){ return true; } else{ return false; }*/
I still get the error message...
What's the syntax for custom fields?
cfValues['CF name'] or cfValues['CF ID']
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Bert,
Do you just need a custom field to calculate time difference between two custom date fields? Or you need a workflow condition/validation to calculate difference and set your workflow accordingly?
If you raise an issue describing the details, I can add such a feature to Enhancer Plugin ASAP.
Tuncay Senturk
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A user may not be able to create an issue if the timespan between start and end date(time) is less than 4h.
The difference don't have to be stored, it may be calulated when the user wants to create the issue.
So custom field not necessary, prefer the condition/validation
btw: TY :D
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Sorry but it is not clear for me.
How will those custom fields be calculated, if there is no issue?
I mean, custom fields are located in an issue, but you want to calculate according to two custom fields.
My question, where will these fields take place, so that workflow condition will check for them?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Including a prt scr for some clarification
When an user wants to create an issue, they have to fill in the start and end date.
If they click on 'create', a message will appear if the difference between those 2 is less than 4 hours.
(like now, except my condition is wrong)
(gd, why cant i upload a picture? ><)
old fashion way: http://tinypic.com/r/201e1c/8
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hmm, I got the point now. It will do a validation according to user inputs.
By the way, I have just seen that you are using JIRA 4.2
I am sorry, it is impossible to implement a feature to support JIRA 4.2
Sorry again
Tuncay
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Nor problem, thanks anyway for your time and interest.
JIRA 4.2 is my problem, it's not so supported anymore.
We are slowly upgrading to a 6 version (atm only for testing), but we work on JIRA 4.2
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello!
For any calculations in Confluence, including any manipulations with table data, you may use CelesteCS Math for Confluence.
Assume you have a table with three columns and three rows on your page – from A1 till C3, where row 1 is the header row. The sum calculation formula for rows 2 and 3 will be simple:
SUM(Table1.A2:C3) |
There is a plenty of other functions in the macro, so you may perform any calculations using formulas in EXCEL style.
Thanks!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
SIL custom field, use this script:
interval age = currentDate() - created;
return
"This issue is "
+ age +
" old"
;
replace currentdate() and created with customfield_000000 where 00000 = the custom field IDs.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.