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
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
No it's return -
com.atlassian.jira.issue.ModifiedValue@2bfa0b2e
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't quite understand what you mean..
do you mean it returned
com.atlassian.jira.issue.ModifiedValue@2bfa0b2e
?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes like I said.. :/
def currentWorklog = mIssue.getModifiedFields().get("worklog")
return :
com.atlassian.jira.issue.ModifiedValue@2bfa0b2e
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To start debugging, add some logging so you can determine if "currentWorklog" is getting a value.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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]
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.