How to use "Set Field Value to constant or Groovy expression Function"

Alexander Regler June 11, 2015

Hi there,

 

I've set the "Set Field Value to constant or Groovy expression Function" in the create transition of a subtask workflow. This function is placed after the "Creates the issue originally. " function. It should set the field "Remaining Estimate" which is a Long Field to a certain value. As groovy expression I've set "new Long(10)". But this won't work. After creating the subtask the field is empty.

Any hints?

 

Thanx

Alexander

6 answers

1 accepted

0 votes
Answer accepted
David _old account_
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 11, 2015

I just tried exactly what you did (but without checking "Copy only if not set") and it worked just fine (it set the remaining estimate to 10 seconds). You cannot use the "Copy only if not set" option because this field always has a value (zero by default).

0 votes
Alexander Regler June 12, 2015

Yes indeed. So I just have also check if the value is zero and it works how we want it.

 

Thanx David for your help.

 

0 votes
Alexander Regler June 11, 2015

No there is no other error after the "I am here!". I've tried another transition with the same result. The field is not filled.

But if I use another field (description for example) the post function work well. After create of the issue the field is filled.

 

 

0 votes
David _old account_
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 11, 2015

Did you notice any other ERROR after the "I am here!"?

Also, did you try the same function in a non-create transition?

 

0 votes
Alexander Regler June 11, 2015

I've placed the function before and after the Create Issue.The result is the same: negative. And: the post function is called during the transition as the log shows:

 

2015-06-12 09:22:10,719 http-bio-8180-exec-5 ERROR reglera 562x15710x1 1ucisu2 10.100.31.121 /secure/QuickCreateIssue.jspa [jmwe.plugins.functions.SetFieldValueFunction] I am here!


This is how I defined the post function (here without logging):

Configuration.jpg

 

0 votes
David _old account_
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 11, 2015

Did you try moving the post-function to before the Creates the issue originally post-function?

Do you have any error in the logs? To more easily locate the execution of your script, you can try adding a log statement like this at the beginning of your script:

log.error("I am here!");

and look for "I am here!" in atlassian-jira.log

Suggest an answer

Log in or Sign up to answer