The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

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

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

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

DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
TAGS
AUG Leaders

Atlassian Community Events