Parent link custom field is not showing summary of parent key in .csv file
Asked by Naman Jain:

Hi Community,

Is there any possibility that parent link custom field shows the summary of parent key as well with parent key while exporting it into .csv format. however it is showing summary as well in .html format.


Answers:
author: Ste Wright
body: Hi [@Naman Jain](/t5/user/viewprofilepage/user-id/4900668)

Not natively, in a CSV file it only includes the "Parent Link" issue key.

There's other options though - for example...

* Create a custom field - "Parent - Summary", and then use [Automation](https://confluence.atlassian.com/automation/) to populate it (Automation is native to Jira DC v9).
* If you have a scripting App (like Scriptrunner), use it to create a scripted field which populates with the "Parent - Summary"

Once the metadata is available for the child issues in your search, you could then add the field as a column and export it via CSV :)

Ste


author: Judah
body: [@Naman Jain](/t5/user/viewprofilepage/user-id/4900668)

We accomplished this with a ScriptRunner Listener that fires on Issue Created and Updated Events. Probably needs to fine tuning as it's kind of overkill, but this should work for you.   

Our custom field variables are named portParentLinkKey \& portParentLinkSummary. You should be able to grab the Summary of your Parent Link issue and populate it in another field using this code.

I'm on Jira DC - 8.20

```
import com.atlassian.jira.component.ComponentAccessor

import com.atlassian.jira.issue.CustomFieldManager

import com.atlassian.jira.issue.MutableIssue

import com.atlassian.jira.issue.Issue

import com.atlassian.jira.issue.util.DefaultIssueChangeHolder

import com.atlassian.jira.issue.ModifiedValue

import com.atlassian.jira.issue.index.IssueIndexingService

//the issue that was created, ie. any jira issue that is created

def issue = event.issue as MutableIssue

//the Component Accessor class provides static methods for accessing JIRA's managed components

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def issueManager = ComponentAccessor.getIssueManager()

def portParentLinkKey = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Portfolio Parent Link Key")[0]

def portParentLinkSummary = ComponentAccessor.getCustomFieldManager().getCustomFieldObjectsByName("Portfolio Parent Link Summary")[0]

def changeHolder = new DefaultIssueChangeHolder()

def issueIndexManager = ComponentAccessor.getComponent(IssueIndexingService)

//access the Parent Link Field

def parentLink = customFieldManager.getCustomFieldObjectsByName("Parent Link")[0]

//the value of the Parent Link field

def parentLinkValue = issue.getCustomFieldValue(parentLink) as String

//if the parent link field is empty, exit the script

if (parentLinkValue == null) {

    log.debug "Parent link is null: Exit script"

    return

} else {

    log.debug "Parent Link field's value = " + parentLinkValue

    

    def parentIssue = issueManager.getIssueByCurrentKey(parentLinkValue)   

    def key = parentIssue.getKey()

    def summary = parentIssue.getSummary();

    

    log.debug("Parent Link Key = " + parentLinkValue + " Parent Issue Summary: " + summary + " Parent Issue Key = " + key)

                    

    portParentLinkSummary.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(portParentLinkSummary),summary),changeHolder)             

    portParentLinkKey.updateValue(null, issue, new ModifiedValue(issue.getCustomFieldValue(portParentLinkKey),key),changeHolder) 

  

    issueIndexManager.reIndex(issue)    

}
```


Tags: confluence-server

server