Hi Friends,
Hope you all are safe and in good health
I have one query, user is asking for calculation field,
would it be possible to add field to JIRA, containing formula/live calculation?
I have 2 number field Revenue and Time, user want to divide Revenue by Time and put the output in another field name "Profit". Is it possible, please help.
@Stephen_Wright @Nic_Brough__Adaptavist_ @Kristian Walker (Adaptavist) @Adrian_Stephen @Derek_Fields @Ravi_Sagar__Adaptavist_
@Martin Bayer _MoroSystems_ s_r_o__
Thanks
Vikrant Yadav
A bit more advanced than you need, but you can just drop the bit about following links - https://library.adaptavist.com/entity/calculate-the-sum-of-all-values-of-a-custom-field-in-linked-issues
Vikrant, the documentation posted by @Nic Brough -Adaptavist- should be enough, but if you're not programmer, here is a code you should use (I didn't test it so if there are any exceptions, let me know)
NOTE: do not forget to fill in revenueCFId and timeCFId properties with real custom field IDs
import com.atlassian.jira.component.ComponentAccessorimport com.atlassian.jira.issue.Issuedef customFieldManager = ComponentAccessor.customFieldManagerdef revenueCFId = 111def timeCFId = 222def revenueCF = customFieldManager.getCustomFieldObject(revenueCFId)if (!revenueCF) { log.debug ("Custom field with ID " + revenueCFId + " not found") return null}def timeCF = customFieldManager.getCustomFieldObject(timeCFId)if (!timeCF) { log.debug ("Custom field with ID " + timeCFId + " not found") return null}def revenue = issue.getCustomFieldValue(revenueCF)def time = issue.getCustomFieldValue(timeCF)return revenue/time
Hi @Nic Brough -Adaptavist- @Martin Bayer _MoroSystems_ s_r_o__ Thanks you guys for the help. Script is working fine. Providing accurate result.
Thanks a lot ..you are the experts.
Now user is asking to provide result in profit per hour, is it possible to calculate/convert time in hour ? Time field doesn't exists, day and time field is available only. Please suggest if there any solution of this.
Thanks Again!
Stay Safe!
If you have a date or date/time field, you're going to need to come up with a rule to convert it into a length of time
It looks like you're new here. Sign in or register to get started.