Hi, community!
Tell me how can I implement pre-filling fields with values from the epic when creating a “task in the epic”?
As I understand it, the best solution would be "Behavior"? Or maybe there are some ready-made solutions?
Any help is important. Thank you!
Best regards, Alex!
i.e. how the process occurs On your “task in epic” creation screen, you should add a “Link to epic” field, in which you set your task epic, from which the fields on this screen will then be pulled up.
Solution . My Code for Behavior :
in frame "field"
import java.text.SimpleDateFormat
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
def setFieldValueIfNotNull(String fieldName, Object value) {
if (value!= null) {
def customField = getFieldByName(fieldName)
if (customField!= null) {
customField.setFormValue(value)
} else {
log.warn("$fieldName not found")
}
} else {
log.warn("$fieldName not set or value empty")
}
}
def cf_link_on_epic_value = getFieldByName('Link on epic').value
if (cf_link_on_epic_value!= null) {
String epic_value = cf_link_on_epic_value
def parts = epic_value.split(':')
def epicKey = parts[1].trim()
def issueManager = ComponentAccessor.getIssueManager()
def epicIssue = issueManager.getIssueObject(epicKey)
def customFieldManager = ComponentAccessor.getCustomFieldManager()
//Next , your cf fields
/
// CF - "Target start"
def epic_TS = epicIssue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Target start"))
setFieldValueIfNotNull('Target start', epic_TS!= null? formatDate(epic_TS) : null)
// CF - "Target end"
def epic_TE = epicIssue.getCustomFieldValue(customFieldManager.getCustomFieldObjectByName("Target end"))
setFieldValueIfNotNull('Target end', epic_TE!= null? formatDate(epic_TE) : null)
} else {
log.warn("link on epic not set or value empty")
}
///////////////////////////////// !add this part ,if only your cffield datetime, else - delete this
// Function for formatted date
def formatDate(Date date) {
SimpleDateFormat sdf = new SimpleDateFormat("dd.MM.yy")
return sdf.format(date)
}
Hi Alex,
Behaviours is the only one I know of that can do something like this. Many of the Marketplace vendors solutions are around forms, so not sure if they can/do connect to Jira Software projects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alex, there is not a great out of the box solution for this. If you have custom fields which only apply to epics, you could use default values, but that is likely a limited use case.
You'll need to install and configure a plugin. ScriptRunner is one option, but there are numerous other template plugins out there which could also potentially solve your issue. I ran a search in the marketplace and found several potential options.
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.