Change the issuetype with scriptrunner

Alexander Herrler October 7, 2020

Hello,

I would like to change the issue type after receiving the ticket with scriptrunner.

The workflow is different from the entrance workflow but it is the same project.

Background:
The tickets are automatically created in the service desk by a mail handler. However, a different issuetype should be selected for one customer.

Do you have any ideas?

Many thanks for your help.

 

Alex

2 answers

2 accepted

Suggest an answer

Log in or Sign up to answer
0 votes
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
October 7, 2020

Moving issues via scriptrunner or JAVA api is not trivial.

Think of all the steps you have to go through when you move an issue manually.
All those steps would have to be accounted for in a move script without the opportunities to prompt the users for many critical pieces of information. 

I haven't seen anyone implementing this successfully (and I haven't dared to try myself).

I think using a "Clone Issue And Link" or "Create Sub-task" post-function script as suggested in another answer will be your best bet. Both of those come with a "Condition" code block where you can examine the reporter's email address and decide whether or not to execute the function.

The condition script could be as simple as 

issue.reporter.emailAddress.endsWith('xyz.com')

Just that single line will return either true (execute the function) or false (skip the function)

The rest of the function parameters are all form-driven, so no coding required.

0 votes
Answer accepted
Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2020

Hi @Alexander Herrler - Why don't you consider creating sub-tasks instead of changing issue types of newly created issues You can create sub-tasks with the post-functions (script runner).

Alexander Herrler October 7, 2020

Thanks @Niranjan , thats a good idea.

But where in the script can I put an "IF" condition that the script only creates tickets as subtask when it comes from customer XY (E-Mail Adress)?

Do you know this?

Niranjan
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
October 7, 2020

Hi @Alexander Herrler ,

I am sure that the post-function of Sub-task creation can be done based on condition using Script runner. You may need to check how to identify issues created via emails. May be if the description has the email address of the sender, you need to validate the description field for the email address.

TAGS
AUG Leaders

Atlassian Community Events