To create issuelinks based on transition

We are trying to create issuelinks based on a particular transition through Jira REST API from Python. As a first step, I am trying to link the issues separately using below command and it works.

jira.create_issue_link(type=link_type, inwardIssue=inward_issue, outwardIssue=outward_issue)

As a second step, I am trying to perform the transition [screen has been added to enter few fields in the workflow] using below command. Eventhough the ‘linked issues’ field has values [created using above step], it is throwing an error message to enter the ‘linked issues’ field values.

jira.transition_issue(src_issue, transition=‘Closed’, fields={‘resolution’: {‘name’: ‘Duplicate’}})

Error message : Please select “duplicates” in Linked Issues field and provide the duplicate ticket

Can anyone provide your suggestion on to how to fix this error and also how to pass linked issues field values in the jira.transition_issue.

https://docs.atlassian.com/software/jira/docs/api/REST/8.21.0/#issue-doTransition

Have you tried including Linked Issues field in the payload when performing the transition?

yes KCWONG, we tried giving linked issues in the fields and got an error “Field does not support update ‘issuelinks’”

Quoting from the doTransition doc:

Perform a transition on an issue. When performing the transition you can update or set other issue fields.

The fields that can be set on transtion, in either the fields parameter or the update parameter can be determined using the /rest/api/2/issue/{issueIdOrKey}/transitions?expand=transitions.fields resource. If a field is not configured to appear on the transition screen, then it will not be in the transition metadata, and a field validation error will occur if it is submitted.

Perhaps you should try the above API to see what field names the transition wants.

Thank you KCWong, I tried your recommendation and here is our observation

“issuelinks”:{“required”:false,“schema”:{“type”:“array”,“items”:“issuelinks”,“system”:“issuelinks”},“name”:“Linked Issues”,“fieldId”:“issuelinks”,“operations”:[“add”]}

“fields”:{“resolution”:{“required”:true,“schema”:{“type”:“resolution”,“system”:“resolution”},“name”:“Resolution”,“fieldId”:“resolution”,“operations”:[“set”]

Looks like resolution field is mandatory for Closed transition and it is accepted in Fields parameter. Whereas issuelinks is not mandatory but still the transition is not successful.

I am not sure if changing Operations from add to set for issuelinks will solve the issue to update issuelinks using fields parameter

We also tried the following syntax

jira.transition_issue(src_issue, transition=transition_id, fields={
‘resolution’: {‘name’: ‘Duplicate’},
‘issuelinks’: [
{‘type’: {‘name’: ‘Duplicate’}, ‘inwardIssue’: {‘key’: inward_issue}},
{‘type’: {‘name’: ‘Duplicates’}, ‘outwardIssue’: {‘key’: outward_issue}}
]
})

but ended up with the error "Field does not support update ‘issuelinks’

Dear KCWong,

Could you please guide us on this issue.

Regards,
Senthil