You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
Heya folks!
I kinda have a strange error I can't figure out. I want a sub task with the name of the month to be created based on the value of a custom field. So I created 12 post functions of 4 different kinds checking if the custom field "period" is set to "yearly", "half yearly", "quarterly", "monthly".
So I'm using the 12 post functions with the follwoing conditions and additional actions:
For post function 1,2,4,5,7,8,10,11:
Condition: issue.issueType.name == 'Task' && cfValues['Period']?.value == 'Monthly'
Additional Action: issue.summary = "January - "+sourceIssue.summary
(and same for February, April, May, etc.)
For post functions 3 and 9:
Condition: issue.issueType.name == 'Task' && (cfValues['Period']?.value == 'Monthly' || cfValues['Period']?.value == 'Quartery')
Additional Action: issue.summary = "March - "+sourceIssue.summary
(same for September)
For post function 6:
Condition: issue.issueType.name == 'Task' && (cfValues['Period']?.value == 'Monthly' || cfValues['Period']?.value == 'Quarterly' || cfValues['Period']?.value == 'Half Yearly')
Additional Action: issue.summary = "June - "+sourceIssue.summary
For post function 12:
Condition: issue.issueType.name == 'Task' && (cfValues['Period']?.value == 'Monthly' || cfValues['Period']?.value == 'Quarterly' || cfValues['Period']?.value == 'Half Yearly' || cfValues['Period']?.value == 'Yearly')
Additional Action:
Additional Action: issue.summary = "December - "+sourceIssue.summary
With that way I have 12 sub tasks being created if "Monthly is select, 4 sub tasks if "Quarterly" is select, 2 for "Half Yearly" and 1 for "Yearly". And each sub task will start with the correct month name.
All the post functions are working. However, now the problem: when I'm editing one of the post functions, even if I'm copy pasting the same code in, they stop working and do not create the sub tasks anymore. This is always only affecting the edited post function. That is very strange and I can't find the reason for it. The only way to get them to work again is, deleting it and then recreating it, which is painful if I want to change something in all 12 post function.
The error I'm getting then is:
2020-03-05 09:21:34,644 ERROR [workflow.AbstractScriptWorkflowFunction]: ************************************************************************************* 2020-03-05 09:21:34,652 ERROR [workflow.AbstractScriptWorkflowFunction]: Script function failed on issue: ITIKS-30, actionId: 261, file: null java.lang.NullPointerException: Cannot get property 'id' on null object
Does anyone have an idea or did encounter a similar problem? We are working with Jira version 7.12.3, which hopefully we will upgrade soon. But not sure if it may be related to that. I'm grateful for any idea :)
In the screen below for example I edited function 12, which was working before but since the edit didnÄt work again even if I copy in the old code. The only time it worked again was when it wasn't triggered:
Can you try putting the post functions after "Update Change history for an issue and store the issue in the database" and see if that helps?
Kind regards
Jorden
PS: keep the other default items in order, so simply move all the post functions until after the update and store default one
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Heya @Jorden Van Bogaert
Thanks for your reply! I changed the order as suggested (see screenshots 1 & 2). Please let me know, if that order was correct. Then I edited the December post function as it's the easiest to test. I simply added "new" to the string for the summary (screen-3).
Sadly the same error as listed in the original description showed up after the new workflow got published and I tested it (screen-4).
Let me know if I did anything different from what you suggested ;)
Kind regards
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Mm, that's a tricky one. The way you ordered the post function is exactly what I meant :)
I agree that it is a very strange that is happening. If you're showing the full error, I actually think the error comes from the internal code of ScriptRunner. Have you checked whether a bugfix version for the add-on exists? (marketplace is currently down, so you'll have to wait on that to update the add-on).
Sorry I'm not of any more help on this one. :/
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No worries @Jorden Van Bogaert,
Anything we can exclude helps :)
until then I hope, that an update may fix the problem at some point. Just for reference, this is the full error:
Time (on server): Thu Mar 05 2020 11:36:31 GMT+0100 (Mitteleuropäische Normalzeit)
The following log information was produced by this execution. Use statements like:log.info("...") to record logging information.
2020-03-05 11:36:31,077 ERROR [workflow.AbstractScriptWorkflowFunction]: ************************************************************************************* 2020-03-05 11:36:31,077 ERROR [workflow.AbstractScriptWorkflowFunction]: Script function failed on issue: ITIKS-30, actionId: 261, file: null java.lang.NullPointerException: Cannot get property 'id' on null object at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue$_copySystemFieldValues_closure9$_closure13.doCall(AbstractCloneIssue.groovy:438) at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue$_copySystemFieldValues_closure9.doCall(AbstractCloneIssue.groovy:437) at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.copySystemFieldValues(AbstractCloneIssue.groovy:433) at com.onresolve.scriptrunner.canned.jira.utils.AbstractCloneIssue.execute(AbstractCloneIssue.groovy:181) at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.super$4$execute(CreateSubTask.groovy) at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask.execute(CreateSubTask.groovy:141) at com.onresolve.scriptrunner.canned.jira.workflow.postfunctions.CreateSubTask$execute.callCurrent(Unknown Source) at com.onresolve.scriptrunner.canned.jira.workflow.AbstractWorkflowCannedScript.execute(AbstractWorkflowCannedScript.groovy:17) at com.onresolve.scriptrunner.canned.jira.workflow.AbstractWorkflowCannedScript$execute$0.call(Unknown Source) at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction$_run_closure1.doCall(AbstractScriptWorkflowFunction.groovy:93) at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction$_run_closure1.doCall(AbstractScriptWorkflowFunction.groovy) at com.onresolve.scriptrunner.runner.diag.DiagnosticsManagerImpl$DiagnosticsExecutionHandlerImpl.execute(DiagnosticsManagerImpl.groovy:325) at com.onresolve.scriptrunner.runner.diag.DiagnosticsExecutionHandler$execute$3.call(Unknown Source) at com.onresolve.scriptrunner.jira.workflow.AbstractScriptWorkflowFunction.run(AbstractScriptWorkflowFunction.groovy:86)
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 see anything actually referring to any of the code you have provided the post function, so I really assume it's going to be within the scriptrunner code itself (but I might be wrong).
The marketplace seems to be running again, so I'd recommend checking for an update of scriptrunner there :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks @Jorden Van Bogaert
I will try that. But we have a maintenance and upgrade contract, so the updates of Jira and the add-ons will be planned together to ensure we have compatible versions, so I will need to wait a bit for that.
Anyway, thanks for the time you invested to help me investigating.
Very appreciated :)
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.