Forums

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

Worklog on transition screen

Neta Elyakim
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 Leaders.
June 4, 2018

Hey,

How can I get worklog value on transition screen during the transition (I need to use it to set another field) with scriptRunner post function?

This is not working-

 def worklog = issue.getModifiedFields().get("worklog")

I'm not getting the value.

Please help.

Thanks

1 answer

0 votes
Tyler Brown-Jones June 4, 2018

Hi Neta,

The below code works for me, are you setting the 'issue as MutableIssue' ?

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue

def mIssue = issue as MutableIssue
def currentWorklog = mIssue.getModifiedFields().get("worklog")

https://docs.atlassian.com/software/jira/docs/api/7.1.9/com/atlassian/jira/issue/MutableIssue.html 

Hope it helps

Tyler

Neta Elyakim
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 Leaders.
June 5, 2018

No it's return - 

com.atlassian.jira.issue.ModifiedValue@2bfa0b2e
Tyler Brown-Jones June 5, 2018

I don't quite understand what you mean..

do you mean it returned

com.atlassian.jira.issue.ModifiedValue@2bfa0b2e

 ?

Neta Elyakim
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 Leaders.
June 5, 2018

Yes like I said.. :/

def currentWorklog = mIssue.getModifiedFields().get("worklog")

return :

com.atlassian.jira.issue.ModifiedValue@2bfa0b2e
Tyler Brown-Jones June 5, 2018

To start debugging, add some logging so you can determine if "currentWorklog" is getting a value.

Neta Elyakim
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 Leaders.
June 5, 2018

I tried to do that already

import com.atlassian.jira.issue.Issue
import com.atlassian.jira.issue.MutableIssue

def mIssue = issue as MutableIssue
def currentWorklog = mIssue.getModifiedFields().get("worklog")
log.warn("----------currentWorklog--------------: "+currentWorklog)
log.warn("----------currentWorklog.class--------------: "+currentWorklog.class)
log.warn("-------------------currentWorklog--getProperties() -----------: "+currentWorklog.getProperties())

log.warn("-------------------currentWorklog--getNewValue() -----------: "+currentWorklog.getNewValue().getProperties())//.getValueFromParams())
log.warn("-------------------mIssue.getModifiedFields()------------: "+mIssue.getModifiedFields())
 

and it's didn't return something that I manage to work with 

 

return :

2018-06-05 14:14:26,528 http-nio-8080-exec-19 WARN admin 854x2727x1 1hzdo7a 0:0:0:0:0:0:0:1 /secure/CommentAssignIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] ----------currentWorklog--------------: com.atlassian.jira.issue.ModifiedValue@797d32a6
2018-06-05 14:14:26,528 http-nio-8080-exec-19 WARN admin 854x2727x1 1hzdo7a 0:0:0:0:0:0:0:1 /secure/CommentAssignIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] ----------currentWorklog.class--------------: class com.atlassian.jira.issue.ModifiedValue
2018-06-05 14:14:26,528 http-nio-8080-exec-19 WARN admin 854x2727x1 1hzdo7a 0:0:0:0:0:0:0:1 /secure/CommentAssignIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] -------------------currentWorklog--getProperties() -----------: [newValue:com.atlassian.jira.issue.fields.WorklogSystemField$WorklogValue$Builder$1@724e4986, class:class com.atlassian.jira.issue.ModifiedValue, oldValue:null]
2018-06-05 14:14:26,528 http-nio-8080-exec-19 WARN admin 854x2727x1 1hzdo7a 0:0:0:0:0:0:0:1 /secure/CommentAssignIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] -------------------currentWorklog--getNewValue() -----------: [editIssue:false, createIssue:false, class:class com.atlassian.jira.issue.fields.WorklogSystemField$WorklogValue$Builder$1, set:true, activated:true]
2018-06-05 14:14:26,528 http-nio-8080-exec-19 WARN admin 854x2727x1 1hzdo7a 0:0:0:0:0:0:0:1 /secure/CommentAssignIssue.jspa [c.o.s.jira.workflow.ScriptWorkflowFunction] -------------------mIssue.getModifiedFields()------------: [worklog:com.atlassian.jira.issue.ModifiedValue@797d32a6]

Suggest an answer

Log in or Sign up to answer