Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

I want to make one project where I will track Daily work and Task of Team. How can I see their last

Kajol Saifi
March 23, 2023

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.

2 answers

0 votes
Tanu
Contributor
January 16, 2020

@Aisha M  did the above script worked ?

0 votes
Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 15, 2018

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.

Aisha M
Contributor
May 15, 2018

@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 ? 

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 15, 2018

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.

Aisha M
Contributor
May 15, 2018

@Alexey Matveev Thank you. I will try adding another listener and see how it goes :) 

Aisha M
Contributor
May 23, 2018

@Alexey Matveev

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)
    }

}

Alexey Matveev
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
May 23, 2018

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)

Aisha M
Contributor
May 24, 2018

@Alexey Matveev Thank you. That script did not work. 

Aisha M
Contributor
May 28, 2018

@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);

Suggest an answer

Log in or Sign up to answer