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.
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.
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.
Used script for log work:
log work for participants
def Category log = Category.getInstance("com.onresolve.jira.groovy.PostFunction")
//def issue = ComponentAccessor.getIssueManager().getIssueObject("SD-52450")
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()
String comment = transientVars.comment as String
log.debug "comment: " + comment
log.debug "transientVars : " + transientVars
comment = transientVars.get("Comment")
log.debug "comment is null, new value: " + comment
//def reporter = issue.reporter.name
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")
log.info("minutes : $timespent")
def worklog = new WorklogImpl2(issue, null, actionUserName, comment, new Date(), null, null, timespent, UsersRole)
worklogManager.create(issue.reporter, worklog, 0L, true)
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.
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 ?
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