Forums

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

Program a custom field

Tselun Tsai
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 18, 2020

How can I set a custom field value programically based on its parent issue type?

 

I need to modify the code below for a customer field with issue type of "design requirement".  When its parent is an issue type called "Milestone", the value will be set with 

 issueObject.getParentObject().getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10000")).getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10002"));

 

That is the original code below.  Now, I need to add the second condition.  When its parent is an issue type called "NTO", the value will be set with 

issueObject.getParentObject().getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_12904"));

 

Please help.  Thanks in advance.

==========================================================

<!-- @@Formula:

import com.atlassian.jira.issue.CustomFieldManager;

import com.atlassian.jira.component.ComponentAccessor;

String s = issue.get("issuetype").getName();

CustomFieldManager customFieldManager = ComponentAccessor.getCustomFieldManager();

if (s.equals("Design Requirement") return

 issueObject.getParentObject().getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10000")).getCustomFieldValue(customFieldManager.getCustomFieldObject("customfield_10002"));

return null

-->

1 answer

1 accepted

1 vote
Answer accepted
Angélica Luz
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
August 25, 2020

Hello @Tselun Tsai,

Thank you for reaching out to Atlassian Community!

I saw that you created a ticket with our support related to the same question and you said that you contacted the vendor and the issue was resolved.

Please, feel free to share the resolution here to help other community members that may have the same question.

Regards,
Angélica

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events