Forums

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

In JIRA Cloud how can I auto fill the custom field value with the parent issue ID on sub-task screen

Ramesh May 16, 2025

Could someone please help me to do on the JIRA cloud using Behaviours or with any alternative way, how can I auto-fill the 'DataCenter Link' custom field value  with the parent issue ID on the sub-task screen (where the issue type is 'Rack Subtask') like uploaded imageJIRA_DataCenter.png  but not after the sub-task is created?

2 answers

0 votes
Darryl Lee
Community Champion
May 16, 2025

Hi @Ramesh --

I second @Trudy Claspill 's question as to why you want to duplicate data that is already visible in every subtask (also, the subtask parent value is available in Automation, API calls, JQL, etc.)

But ALSO, I'm curious about this requirement of yours:

but not after the sub-task is created?

Because my first instinct was to suggest an Automation, which could absolutely do this after a subtask is created.

Is there some reason that users need to see this value when they're creating a subtask? Should they be able to override it? (That seems inadvisable if it is a subtask.)

If you can help clarify, that would improve our answers.

Ramesh May 16, 2025

Thank you@Darryl lee for reply.

I am able to populate the Datacentre Link field in the created sub-task using an automation rule,

but the requirement is that this field must also be mandatory on the sub-task creation screen. So they are expecting to fill the custom field value with the parent issue id in the create sub task  screen auto-fill is not working. Kindly help me to suggest is there any alternative way that I can achieve.

0 votes
Trudy Claspill
Community Champion
May 16, 2025

Hello @Ramesh 

What have you tried so far?

I am curious about what problem you are trying to solve by adding the sub-task's parent issue ID to the Create Issue screen when the parent issue is visible in the background. Can you elaborate on that?

Ramesh May 16, 2025

I have tried below script through Behaviours in ScriptRunner In JIRA cloud

getting the parentIssue.id and parentIssue.key but parent issue ID is not adding in sub task screen of the "DataCenter Link" field value

import com.atlassian.jira.component.ComponentAccessordef

targetField = getFieldByName("DataCenter Link")
def parentIdStr = getFieldById("parentIssueId")?.value?.toString()if (!targetField || !parentIdStr) returndef issueManager = ComponentAccessor.issueManager
def parentIssue = issueManager.getIssueObject(parentIdStr.toLong())if (parentIssue) {
    log.warn("Setting 'DataCenter Link' with issue ID: ${parentIssue.id}, key: ${parentIssue.key}")    
    targetField.setFormValue([
        "key": parentIssue.key,
        "id": parentIssue.id.toString()
    ])   
    targetField.setReadOnly(true)

Note: I am able to enter parent issue ID manually on "DataCenter Link" field textbox

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events