Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Next challenges

Recent achievements

  • Global
  • Personal


  • Give kudos
  • Received
  • Given


  • Global

Trophy case

Kudos (beta program)

Kudos logo

You've been invited into the Kudos (beta program) private group. Chat with others in the program, or give feedback to Atlassian.

View group

It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Work log Edited

When service-desk agent wants do log work it duplicates:
Please help me to solve this problem.

1 answer

0 votes
Andy Heinzer Atlassian Team Dec 12, 2019

Hi Jamil,

I see that you appear to have duplicate work log entries here.  I have not yet seen this problem before, and I can't seem to find any other reports of this.  However I'd like to try to learn more about your environment here.

  • Are the worklogs in this case being entered from the More -> Log work menu?  Or are the agents adding their time during an transition screen for example instead?  Or is there some other way that work is being logged on these issues?
  • What version of Jira Service Desk is this?
  • Are you using any other kind of time tracking plugins with this Jira server site, such as tempo or others?

I tried to recreate this problem in my own Jira Service Desk, but so far I have not been able to.  Perhaps if we can learn more about your environment here I can better help guide you to a solution.


We have log work transition on customer portal:
Log work transition.PNG


Agents do log work using screen:


@Andy Heinzer 
Service Desk Version:
JIRA Service Desk 3.16.1

@Andy Heinzer 
This problem rarely happens but we want avoid this.
Normally it indicates only one log work but sometime it can be duplicated.

Andy Heinzer Atlassian Team Dec 16, 2019

I'm having some difficulties trying to replicate this problem.  Could we take a closer look at the workflow being used for this step?  I'd be interested to see what steps it might have for the post-functions here.

Also are you using any sort of plugins for Service Desk here?  In my setup, the customer portal doesn't quite have all the same options I can see in yours, so I'd be interested to better understand why there is a difference between the available options here.

@Andy Heinzer 

Used script for log work:


log work for participants

import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.ComponentManager
import com.atlassian.jira.issue.IssueManager;

import com.atlassian.jira.issue.worklog.WorklogImpl2
import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.worklog.DefaultWorklogManager
import com.atlassian.jira.user.ApplicationUser

import org.apache.log4j.Category
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")

//def issue = ComponentAccessor.getIssueManager().getIssueObject("SD-52450")
def actionUserName

def componentManager = ComponentManager.getInstance()
def customFieldManager = ComponentAccessor.getCustomFieldManager()

def minutesSpent = customFieldManager.getCustomFieldObjectByName("Minutes spent")
def minutes = issue.getCustomFieldValue(minutesSpent) as Integer

def actionUser = customFieldManager.getCustomFieldObjectByName("Action User")
def ActionUser = issue.getCustomFieldValue(actionUser) as ApplicationUser

if(ActionUser != null)
actionUserName = ActionUser.getKey()

log.debug("actionUserName: $actionUserName")"actionUserName: $actionUserName")

log.debug("minutes: $minutes")"minutes: $minutes")

String comment = transientVars.comment as String
log.debug "comment: " + comment
log.debug "transientVars : " + transientVars
if (!comment)
comment = transientVars.get("Comment")
log.debug "comment is null, new value: " + comment
//def reporter =
def worklogManager = ComponentAccessor.getWorklogManager();

if (minutes != null && actionUserName != null)
ProjectRoleManager projectRoleManager = ComponentManager.getComponentInstanceOfType(ProjectRoleManager.class) as ProjectRoleManager
def UsersRole = projectRoleManager.getProjectRole("Users")
long timespent = minutes * 60 as long

log.debug("minutes : $timespent")"minutes : $timespent")

def worklog = new WorklogImpl2(issue, null, actionUserName, comment, new Date(), null, null, timespent, UsersRole)
worklogManager.create(issue.reporter, worklog, 0L, true)
log.debug("worklog created")"worklog created")

log.debug("actionUserName: $actionUserName")"actionUserName: $actionUserName")
//return actionUserName

else {

@Andy Heinzer 
As you can see from the post-functions image there used JWT plugin and the script.

Andy Heinzer Atlassian Team Dec 19, 2019

I'm afraid I'm not very familiar with using the JWT plugin or this script itself.  Could you let me know more about this?  I suspect that step 3 in postfunctions it what is responsible for converting the minutes input into a worklog entry.  This script is being run via the scriptrunner plugin, right?

I'm not sure I understand what steps 2,5,6 are actually doing here.  I can read what they say, but since I'm not familiar with the use of the JWT plugin, it's unclear to me what steps they might be taking in addition to that script itself which looks like groovy code.

I suspect that the action to log work is somehow getting called twice within the same thread, but having reviewed the script there, it is not clear to me yet why that might be.  I'd be interested to see if it's possible to remove the other JWT post functions there to see if the log work still functions.  If not, then perhaps changing the order here might prove beneficial as sometimes the order in which a post-function appears in the workflow can have significant effects on its behavior.

Hi @Jamil Rahimov , @Andy Heinzer ,

from what I see, post function #2 is used to set a 'helper field' 'Action User' with the current user if no dedicated action user is present.

Post functions #5 and #6 are used to clear the 'Action user' as well as the 'Minutes spent' afterwards.

All of the aforementioned post functions should have no effect on the actual work logging. That said, duplicate entries must come either from a duplicate creation within the script itself, or a duplicate execution of this transition. The second option could be excluded if comments that are entered appear only once.

That said, is there a specific reason you're not using the JWT post function to log work @Jamil Rahimov ? 


Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you