I need to create a Project where I Can Track the Daily Book of Work of My team. In that, I need to check who updated their task or comment day-wise and who doesn't. Also, How can I figure out the performance of the candidates.
It works correctly. In the script you look for subtasks, that is why your script works only for the parent task. Your scripts for the create subtask and update parent task must be different. For the create event you should get the parent of the issue, get the fix version and save it to the event issue.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Alexey Matveev Hello. Thanks for the comment. So, I need to create another listener to copy the Fix Version of parent when a sub task is being created ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You can either create another listener or use the same one. But you need to define in the listener whether the event issue is a sub-task or the parent task and then code different logic.
For parent task you would iterate over sub-tasks and set the fix version for the sub-tasks (that is what your script does right now)
For subtasks you would find the parent task, take the fix version and set the fix version for the sub-task.
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.
I came across the below script for a similar scenario. Would this work for my requirement. (Not from a developmental background, so had trouble writing one myself)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.ModifiedValue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
if(!event.issue.isSubTask() && !event.issue.getSubTaskObjects()){
return
}
def customFieldManager = ComponentAccessor.customFieldManager
if(event.issue.isSubTask()) {
def parent = event.issue.getParentObject()
def status = parent.status.name
def parentStatus = customFieldManager.getCustomFieldObjectByName("Fix Version/s")
def changeHolder = new DefaultIssueChangeHolder()
parentStatus.updateValue(null, event.issue, new ModifiedValue(parentStatus.getValue(event.issue), status), changeHolder)
}
if(event.issue.getSubTaskObjects()){
def subtasks = event.issue.getSubTaskObjects()
def status = event.issue.status.name
subtasks.each {
def parentStatus = customFieldManager.getCustomFieldObjectByName("Fix Version/s")
def changeHolder = new DefaultIssueChangeHolder()
parentStatus.updateValue(null, it, new ModifiedValue(parentStatus.getValue(it), status), changeHolder)
}
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try to log info into the atlassian-jira.log and have a look if it works as you expect. You can log with log.error("variable: " + variable)
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.
@Alexey Matveev Hello Alexey, can you please validate the below script, (I am so sorry for troubling you so much)
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.CustomFieldManager
import com.atlassian.jira.issue.IssueManager
import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue
import com.atlassian.jira.issue.util.DefaultIssueChangeHolder
import com.atlassian.jira.issue.ModifiedValue
def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Fix Version")
//def field = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("fixVersion")
def parentMyFieldValue = issue.parentObject.getCustomFieldValue(field)
def changeHolder = new DefaultIssueChangeHolder();
field.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(field), parentMyFieldValue),changeHolder);
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.