Context:
I am trying to perform some automation between our Jira Service Desk and the Jira Projects of our teams using Adaptavist Scriptrunner. I'm new to the tool so I'm trying to stick with the default functions that are provided by Scriptrunner.
Goal:
My goal is to clone, move and link a service desk ticket to different jira (software) project when a specific event is triggered.
(Attempt at) execution:
I am trying to accomplish this using the default or preset Scriptrunner function "Clones an issue, and links". Which more or less does exactly what I need. here is some information about the function.
I set up the listener with data that I have triple checked by now, and have also tried to tone down in complexity to make sure that nothing was getting messed up in the "Condition" or "Additional issue actions" script fields.
Test:
I manually trigger the event by changing the status of some tickets in the Service Desk. I expect to see a linked issue to be created in the backlog of the targeted project.
Result:
No linked issue shows up on the Service Desk ticket of which I just changed the status. Refreshing the page also shows no change. When manually checking the backlog of the targeted project, I see no new issues that were created via the clone/move that I would expect.
When I check the listener in the Scriptrunner app, it always shows me that there were no failures with the last X amount of executions.
So it seems that either the listener IS executing, but I have no idea what it is actually doing. Or that something is wrong with the listener and that it is not doing anything at all but still showing that the exectution is ok.
There is very little information available to me to go and investigate what this listener is actually doing or trying to do behind the scenes. There is some Payload data available when I check the Execution data in the History column shown in the image above, but this just gives me a bunch of info about the Service Desk ticket on which i triggered the event.
I have no idea how to find out what I am doing wrong, If I'm doing anything wrong at all. Does anyone have any experience with this sort of thing?
Thanks in advance.
Jira Service Desk version; 4.3.1
Jira Software version; 8.3.1
Scriptrunner version: 6.21.0
Can you include some screenshots of your configurations?
Are you positive that the last field in the form is correctly populated: Issue Link Type / Direction
If you leave that blank, no links are created between the original and cloned issue.
If that's correct but you still don't get links, make sure the "run as" user has permission to create links.
The logs area in the execution history will only show logs that you manually output using log.info("some text") either in the condition or in the additional action blocks.
Hi Peter-Dave,
I am positive that the last field was filled out. I have also checked but there aren't even any issues being created in the target project, so there is nothing to be linked.
I am Jira Admin of our entire server at the moment (as of recently so I am not very experienced yet) and I should have all the necessary rights to move/clone/create issues. When I navigate to the relevant projects I am able to perform these actions manually so that confirms it.
Some screenshots and extra info below.
The two screenshots above show the configuration of the listener. There was a bunch of codes in the "Conditions" and "Additional issue actions" fields earlier but I scrapped all of it to be sure that these are not causing the issues.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I've only used this configuration directly in a workflow post function.
Since you are only firing on a single project and workflow event, that might be a better place for it.
But I would try to add the following to condition (just to be sure)
log.info "Evaluating condition for Move to Pending Event: $event.issue"
true
That might give you some clues.
What I'm wondering right now is if this type of built-in script knows how to handle custom events (as yours clearly is). I've worked mostly with system events.
Or, the custom event is not loaded with an issue object and the built-in script doesn't have anything to act on.
You can troubleshoot that by creating a separate custom event and outputting to the log some of the objects bound to the custom event.
But if the built-in script can't work on the custom event, your best bet will be to move the config to the workflow postfunction.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Alright so I've been trying a few more things.
Yesterday evening we had to reset our server because of reasons. Since the server reset, the Listener does seem to work but only if i leave the "Condition" field blank.
When I add my desired condition (which is a component check) it does not run.
log.info "Evaluating condition for Move to Pending Event: $event.issue"
issue.components == 'Jira Service Desk'
Note that I added the log.info line as you suggested, but this does not seem to provide any log info at all. As shown on the screenshot below;
However, when I trigger the Listener when the Condition field is blank (not even the log.info line is in there), the logs do return something. Note that the Listener is working in this case even though this log message shows up.
2021-03-25 18:28:00,290 WARN [servicedesk.ServiceDeskUtils]: Failed to retrieve service desk for KLVV: The Service Desk you are trying to view does not exist.
This leads me to believe that something is wrong with my (very simple) condition.
issue.components == 'Jira Service Desk'
The compared value matches the Component label set on the ticket which I used for testing perfectly. Is something else wrong with this Conditional check?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That's mysterious...
Regarding component condition... try
issue.components.any{it.name == 'Jira Service Desk'}
//or
issue.components.every{it.name == 'Jira Service Desk'}
That's because issue.components should return a list of ProjectCopmonent objects. you want to compare the name of those objects.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Peter-Dave,
I tried
issue.components.any{it.name == 'Jira Service Desk'}
and now it works like a charm! Thank you very much!
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.