Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How get issue type all "Link issue" ?

Alex
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.
November 21, 2023

Hello Atlassian community!

I encountered a problem when I started working with the post function:

"Set Field Value Post Function"

I want my field to take a certain value, if condition receives:

"The current task does not have an associated task with type "Test" ".

My code, unfortunately, only works when there is one link. If there are many links, the code does not work.

 

issue.get("issuelinks")?.first()?.getDestinationObject().issueTypeId == "16205"

What needs to be changed in it?

 

Any help is important!

Thank you!

 

 боль.png

2 answers

1 accepted

0 votes
Answer accepted
Alex
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.
November 24, 2023

The question is no longer relevant. I added my answer to my profile in another post.

https://community.atlassian.com/t5/Jira-questions/How-get-issuetype-in-linkissue-from-Groovy-Scriptrunner/qaq-p/2541515

0 votes
NIKOLAS FREIRE
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
November 21, 2023

Hello, i have some exemple how you can access thye linked issues with python.

from jira import JIRA

user = 'your user'

apikey = 'your api key'

options = {
 'server': server
}

jira = JIRA(options, basic_auth=(user, apikey))
# Sua consulta de filtro aqui
filter_query = 'project in ("your filter")'

# Executando a consulta de filtro
issues = jira.search_issues(filter_query, maxResults=None)  # Remova maxResults para obter todos os resultados

# Variáveis para rastrear totais
total_outward_issues = 0
total_inward_issues = 0
all_issue_keys = []

# Itere sobre as issues retornadas
for issue in issues:
    all_issue_keys.append(issue.key)  # Adicione a chave da issue à lista

    # Acesse as "linked issues" (issues relacionadas)
    linked_issues = issue.fields.issuelinks

    # Conte as "linked issues" desta issue
    outward_issue_count = 0
    inward_issue_count = 0

    for link in linked_issues:
        if hasattr(link, 'outwardIssue'):
            outward_issue_count += 1
        if hasattr(link, 'inwardIssue'):
            inward_issue_count += 1

    # Adicione os totais parciais aos totais gerais
    total_outward_issues += outward_issue_count
    total_inward_issues += inward_issue_count

# Conte o número de chaves únicas
unique_issue_keys = len(set(all_issue_keys))

# Imprima os totais consolidados
print(f'Número de issues únicas: {unique_issue_keys}')
print(f'Total de outward issues: {total_outward_issues}')
print(f'Total de inward issues: {total_inward_issues}')
Alex
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.
November 21, 2023

The question is not about implementation in Python

Suggest an answer

Log in or Sign up to answer