Forums

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

Copy custom field value from one field to another using python scripts

Teja
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.
March 5, 2020

Hi,

I am newbie for jira-python.

I tried adding comments and creating new issue using python script to my local machine.

It could be really helpful for to get python script to how to copy custom field value from another custom field.

Thanks

1 answer

1 vote
Mohamed Benziane
Community Champion
March 19, 2020

@Teja 

I used the jira module for python

https://jira.readthedocs.io/en/master/_modules/jira/client.html

 

You can use this script to begin :

jira = JIRA(basic_auth=("username", "password''), options={'server''http://jiraURL.com'})

issue = jira_server.search_issues('ABC-123')
field = issue.fields.description #my value from the description field

#after that you just have to create or update your issue with this value


new_issue = jira.server.search_issues("DEF-111")
new_issue.update(description = field)



 Hope this helps

Teja
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.
March 20, 2020

@Mohamed Benziane Thanks, I have already got the solution by the jira-python documentation.

jira_options={'server': 'https://jira.abcd.info/'}
jira=JIRA(options=jira_options,basic_auth=('username','xxxxx'))

for issue in jira.search_issues('JQL'):
print('{}: {}'.format(issue.key, issue.fields.customfield_13405))
my_cf=issue.fields.customfield_13405
issue.update(fields={"customfield_16104": my_cf})

+1 upvotes for you.

Regards

Tejas

Suggest an answer

Log in or Sign up to answer