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: 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:
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 ;)
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. :/
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)
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 :)
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 :)
Hi Atlassian Community, My name is Avni Barman, and I am a Product Manager on the Confluence Cloud team. Based on feedback from you, we are giving admins more power to create templates that a...
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
You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events