Problem with Automatic ticket closing while using Jelly Script

Najmul Khan April 3, 2014

Hi Team,

I was trying to close the ticket automatically with the help of Jelly script. The jelly script require user name and password to close the ticket but we can not provide for some security reason. Without password I tried to run the jelly then its run fine in Jelly Runner (Developement environment) But the same code when I trying through service then I am getting the error (<jira:TransitionWorkflow> Found workflow transition with name/id '141' but that is not a valid workflow transition for the current state of issue )

6 answers

0 votes
Deleted user April 9, 2014
Great - good luck!
Najmul Khan June 26, 2014

Hi Ian,

Now we migrated to JIRA v6.1.3 and I am little bit understand the use of Automation plugin.

I have created the rule but at the time of click on save button getting the pop up message "Unknown error. Please reload and try it again" and I tried the same upto five time with different scenerio but then also I am not able to succeed in this.

could you please help me out.

Many thanks for help in advance!

Deleted user June 26, 2014

Hi

I recall getting this error a couple of times early on when we were evaluating the plugin. Unfortunately I can't recall the exact reason. It could have been that the admin session had expired, but I'm not 100% sure. Is there anything in the logs?

For reference we're now running JIRA 6.2.5 with JIRA Automation plugin 1.1.6

Here's the settings we have for our equivalent rule:


Name of the rule: Auto-close resolved issues
Actor of the rule: support
Enable rule once created?: Ticked
Select Trigger: JQL Filter Trigger
CRON schedule: 0 0/30 * * * ?
JQL expression: status = Resolved AND updated <= -1w ORDER BY updatedDate ASC
Limit results: 100
Choose action: Transition issue action
Workflow Transition: Auto-Close (751)
Disable notification for this transition?: Ticked
Transition fields: <blank>


Which translates to a task which

  • runs every 30 minutes
  • executes the Auto-Close (751) workflow transition under the account with the username support
  • for issues which are in the status of Resolved and haven't been updated for over 1 week.

Note, the workflow transition step was specifically created for this purpose. It simply moves an issue from the status of Resolved to the status of Closed and has a condition which means it can only be executed by the support user.

Hope this helps

Ian

Najmul Khan June 26, 2014

Hi Ian,

Getting the below exception in log,

QuartzScheduler_Worker-3 ERROR 953470 [plugin.automation.scheduler.RuleCallable] Exception while executing the rule
java.lang.NullPointerException: value
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:204)

Are you aware with this NullPointerException

Deleted user June 26, 2014

Hi

I've not seen that error, sorry.

Here are some possible lines of investigation:

  • Is the CRON schedule valid? Here's a useful place to test it http://www.cronmaker.com/
  • Is the JQL expression valid? Try create a filter using the exact text and make sure it validates/returns some results
  • Can you log into JIRA as the user specified as the Actor of the rule?
  • Can the Actor of the rule view all the issues returned by the JQL expression AND see the selected workflow transition?
  • Can the Actor of the rule manually perform the selected workflow transition on one of the issues returned by the JQL expression?
  • Are you able to set up the rule without ticking the "Enable rule once created?" option?

Perhaps you can post your settings for the rule?

I'm not associated with the plugin - its provided by Atlassian Labs, so you may also try and post an issue on their issue tracker - https://bitbucket.org/atlassianlabs/automation/issues

Najmul Khan June 30, 2014

Hi Ian,

I checked each and every steps one by one as specified by you. I hope am right every where But I have one doubt,

1. Should I have to create one more transition as (Closed) to close the ticket or it will be close by the existing Closed transition.

Because currently I am using the existing Closed transition and I am still getting the same exception.

And the second link that you provided to me is blocked in my company.

Özerk Dolanbay July 2, 2014

Hi Najmul,

Could you figure out the problem? I get same error as you when I try to create a rule and same exception in my log. The information provided in logs is not detailed so it does not give any idea about the problem. I really need this feature so I have to find a solution. Please let me know if you have.

Thanks.

Özerk Dolanbay July 3, 2014

After a number of tests, I figured out the problem. I didnt enter any value both "limit" and "transition fields" so a null point exception was thrown in logs. When I enter some values to these two fields I dont get the pop up message "Unknown error. Please reload and try it again" anymore. I add the "Transition Issue Action" for my rule while testing. I hope this can help you.

Deleted user July 3, 2014

Hi Özerk

Glad you got your problem sorted.

Najmul,

Does this solve your problem? If not, can you post the settings for your rule?

Özerk Dolanbay July 3, 2014

Thanks Ian. Do you get same error if you leave blank these two fields? If you do then these fields should be marked as required.

Najmul Khan July 3, 2014

Hi All,

Yes Ozerk, I am agree with you.

Thanks Ian now its working for me also.

Deleted user July 3, 2014

Great - feel free to accept the answer :)

0 votes
Najmul Khan April 9, 2014

I am going to upgrade the Jira version, I will try to achieve my requirement through Jira-Automation Plugin.

Many Thank for your valuble answer and help!

0 votes
Najmul Khan April 7, 2014

Please confirm,

I am using Jira 6.0.1, To use the feature of Jira-Automation plugin I need to upgrade my Jira version. Right??

If Yes, Then there is any other workaround to close the ticket automatically after completion of specific time.

Because to upgrade the Jira version is a quite big task and lots of permission have to take from higher authority. Please suggest some workaround for the same.

0 votes
Deleted user April 7, 2014
Hi Sorry, I think the Automation plugin is only compatible with JIRA 6.1 and above. If you do manage to upgrade, the plugin is configured from the Automation link on the left-hand menu of the Add-ins admin area. Once there here's a summary of the steps (sorry I'm away from a JIRA instance at the moment so they are not perfect :) * add a new action * select CRON JQL trigger * enter JQL expression (which can be copied from the advanced search screen) * enter a CRON schedule * on the actions page,select transition issue and enter options.
0 votes
Deleted user April 4, 2014
As an alternative to using Jelly Script/Runner, take a look at JIRA Automation Plugin (https://marketplace.atlassian.com/plugins/com.atlassian.plugin.automation.jira-automation-plugin). It allows you to automatically transition issues to closed by only specifying the username (actor). It's got a number of other cool features too - https://blogs.atlassian.com/2014/02/atlassian-support-uses-jira-automation-plugin/
Najmul Khan April 6, 2014

Hi Ian,

Now, I am trying to close the ticket with the help of Jira-Automation-Plugin. I downloaded and uploaded the plugin in the add-on, After that I am confuse where have to write the JQL and delay in time to run it.

My mean, What to do after installation of the plugin because I am new for this. One more thing I want to add in this that my Jira version is v6.0.1. Is this Jira-Automation Plugin is supporting to Jirav6.0.1.

Will you please help me to come out from this problem.

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2014

It's telling you that the "close" transition is not available for the current status of the issue, although it might be that the person it is running as does not have the rights to perform that transition.

Najmul Khan April 3, 2014

Hi ,

Actually when I am running the Jelly script in the Jelly Runner(Developement Environment) with the user name without the password, ticket gets closed successfully. But with the same user name without the password running the code through the service then I am getting the error ( <jira:TransitionWorkflow> Found workflow transition with name/id '141' but that is not a valid workflow transition for the current state of issue )

can you please help me out from this problem.

Many thanks for your action!

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2014

It's telling you that the "close" transition is not available for the current status of the issue, although it might be that the person it is running as does not have the rights to perform that transition

Najmul Khan April 3, 2014

User have a right to close the ticket, Tickect is getting closed in Developement Environment but through service, Its require a password to close the ticket. Without password error is coming and ticket is not getting close.

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2014

That's because you're running the script as someone who cannot transition the issue. You need to change the permissions to let the script runner do it, or run the script as someone who can.

If you want to log in as a specific person, you need to authenticate somehow, which means using a password. The reason I use Jelly scripts to do this is that the username and password are kept only in the script and that lives on the server's disk, not a public location, so it doesn't matter that I've used a password.

Sreevalsan KMT April 3, 2014

Hi Nic, this means, we still need to store the user credentials (incl password) within the script. This will again violate our security guidelines.

Is there any other way for the auto closure without storing the user details ?

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
April 3, 2014

You have to be a user who has the right to execute the transition. There is no getting around that without coding, and it would be bad practice to do so because you'll be breaking security.

Either allow the transition to be done by anyone, or stop being silly about saving a password on a secured server.

Suggest an answer

Log in or Sign up to answer