How can i move one custom field data to another custom field by using Scripting?

Hi,

I am using JIRA 7.3.0 server. Two custom field 'Tester' is there in my JIRA and i want to move and make it only one custom field 'Tester'. How can i do by using script runnner?

Thanks,

venky.

2 answers

  1. Find all issues with not empty field
  2. Export it to Excel 
  3. Inset all issue keys to script

    import com.atlassian.jira.component.ComponentAccessor
    import com.atlassian.jira.event.type.EventDispatchOption
    import com.atlassian.jira.issue.IssueManager
    import com.atlassian.jira.issue.MutableIssue
    import com.atlassian.jira.issue.UpdateIssueRequest
    import com.atlassian.jira.issue.fields.CustomField
    import com.atlassian.jira.user.ApplicationUser
    
    IssueManager issueManager = ComponentAccessor.getIssueManager();
    UpdateIssueRequest updateIssueRequest = UpdateIssueRequest.builder().eventDispatchOption(EventDispatchOption.ISSUE_UPDATED).sendMail(false).build();
    ApplicationUser curUser = ComponentAccessor.getJiraAuthenticationContext().getUser()
    CustomField copyFrom = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("copyFromName")
    CustomField copyTo = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("copyToName")
    MutableIssue issue;
    
    for(String key: getIssuesKeysForUpdate()) {
        issue = issueManager.getIssueObject(key)
        issue.setCustomFieldValue(
                copyTo,
                issue.getCustomFieldValue(copyFrom))
    
        issueManager.updateIssue(
                curUser,
                issue,
                updateIssueRequest
        )
    }
    
    public List<String> getIssuesKeysForUpdate(){
        return Arrays.asList(
                "key-1",
                "key-2"
        )
    }

 

How can I copy the value of Release Version (Custom Field) to Fix Version/s (System Field) in create screen?

Could you please help me?

Suggest an answer

Log in or Join to answer
Community showcase
Sarah Schuster
Posted Jan 29, 2018 in Jira

What are common themes you've seen across successful & failed Jira Software implementations?

Hey everyone! My name is Sarah Schuster, and I'm a Customer Success Manager in Atlassian specializing in Jira Software Cloud. Over the next few weeks I will be posting discussion topics (8 total) to ...

2,802 views 11 18
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot