Hello, In Jira Server/Data Center we have Checklist plugin installed (okapya). We have a lot of automation based on ScriptRunner/Groovy: make custom fields read-only or hidden, select value or add new options into the select list custom field based on the value in the other custom field.
We also need possibility to manage Checklist behavior with help of ScriptRunner Behaviours on Create/Edit Screens.
Currently request which I got is very simple:
I tried just simple case: created ScriptRunner Behavior to make Checklist field read-only, but it didn't work - checklist is still editable and I can check/uncheck options.
Some quick server-side script I tried in ScriptRunner Behavior for the Checklist custom field:
import com.onresolve.scriptrunner.runner.customisers.WithPlugin
@WithPlugin("com.okapya.jira.checklist")
import com.okapya.jira.customfields.*
import com.okapya.jira.checklist.*
def checklistField = getFieldById(fieldChanged)
Collection<ChecklistItem> items = (Collection<ChecklistItem>) checkboxField.value
items.find(item -> item.getName() == "Help").setChecked(true)
But it doesn't work as well - fails with cast error:
Cannot cast object '{"name":"Help","checked":false,"mandatory":false,"globalItemId":56712,"statusId":"none","rank":6,"id":7,"dueDate":null,"isHeader":false,"priorityId":null,"assigneeIds":[],"version":"5.0","linkedIssueKey":null}' with class 'java.lang.String' to class 'java.util.Collection'
at 0e54872ceb9b5a6e59e4cdcbcb9a102e.run(0e54872ceb9b5a6e59e4cdcbcb9a102e.groovy:8)
I went through the Checklist documentation https://okapya.atlassian.net/wiki/spaces/CHKDOC5/pages/3236659321/Getting+started+with+ScriptRunner and didn't find solutions to manage behavior of the Checklist on Create/Edit screen.
If you have good examples or documentation for my cases, please share.
Thanks in advance.
Checked in 2 different envs:
First instance:
Jira: v9.4.9
ScriptRunner: 8.9.0
Checklist: 6.2.4
Second instance:
Jira: v8.20.13
ScriptRunner: 8.1.0
Checklist: 6.2.4
I have gone through your description, and I have to say, unfortunately, Okapya Checklist is not currently supported by ScriptRunner's Behaviour. Hence, you are getting the current result.
However, a new feature request for this has been created. For your reference, the change request key is SRJIRA-2768.
This feature may be added in future releases.
Also, the current documentation on ScriptRunner provided by Okapya does not apply to ScriptRunner's Behaviour. It is meant for Listeners / Post-Functions / Scripted Fields. Let me know if you want to try something using one of these, and I will try to provide an example.
Another alternative I can suggest is to use the Standard Checklist provided by Jira. I can provide some examples using the Behaviour with the Standard Checklist.
Thank you and Kind regards,
Ram
Hi @Ram Kumar Aravindakshan _Adaptavist_ ,
Thank you for the clarifications.
Another alternative I can suggest is to use the Standard Checklist provided by Jira. I can provide some examples using the Behaviour with the Standard Checklist.
Yes, please, that would be very helpful. Could you please share these examples? I can replace Okapya Checklist with Standard Checklist, and need to implement behavior for these requests:
Set several Checklist options "checked" based on the other custom field value on Create/Edit Screen.
Another request is to make all options in Checklist read-only except one particular option on Create/Edit screen.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Alfira,
Like Ram said, ScriptRunner Behaviours don't currently work with Checklist for Jira.
We have been working in collaboration with Adaptavist to eventually make it work. I will link your community post within our system and we will contact you in this post if/when we release an update that supports Behaviours.
Have a nice day!
Maxime
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.
Hi @Alfira Merinova,
We just released checklist 7.1.0 which includes the ability to use ScriptRunner Behaviors to manipulate checklists!
See our documentation for more details!
Kind regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@Ram Kumar Aravindakshan _Adaptavist_ This is for you expert. :)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Actually, I believe this is for @Maxime Lefebvre _Okapya_ or @Pascal Perreault _Okapya_ ;)
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.