Custom Fields- is there a way to build a field that changes the due date..
For example.
we have a invoice date field
we have a invoice due date field
- want to put invoice date and then a possible drop down that you can select, 15, 30 ,60 and it auto populates the due date field.
Only if you want to do it with Automation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
do you have an example of the automation i would choose?
I looked within Script Runner but i could figure out where i would add your script
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
The script I gave was intended for the script console, but it would be easy to adapt it to run in other places.
The question is where and when do you want the calculation to happen?
Automation will need to ask you the same question - what's the trigger to do it? I have not tried to write an Automation to do it, so I'm not sure how to approach it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Jerrod,
If you have one of the scripting or automation apps, then yes. There are different ways to do it, depending on when you want to trigger the change, and which app you're using, but if you have a recent version of Scriptrunner with HAPI, then the below will do it
Note that:
import java.time.LocalDate
import java.time.format.DateTimeFormatter
def issueKey = "ISSUE-KEY" // Replace with the actual issue key
def invoiceDateField = "Invoice Date"
def paymentTermsField = "Payment Terms"
def invoiceDueDateField = "Invoice Due Date"
def issue = Issues.getByKey(issueKey)
def invoiceDateValue = issue.getCustomFieldValue(invoiceDateField)
def paymentTermsValue = issue.getCustomFieldValue(paymentTermsField)?.value
def invoiceDate = LocalDate.parse(invoiceDateValue, DateTimeFormatter.ofPattern("yyyy-MM-dd"))
def daysToAdd = paymentTermsValue.toInteger()
def invoiceDueDate = invoiceDate.plusDays(daysToAdd)
issue.update {
setCustomFieldValue(invoiceDueDateField, invoiceDueDate.format(DateTimeFormatter.ofPattern("yyyy-MM-dd")))
}
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.