Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Celebration

Earn badges and make progress

You're on your way to the next level! Join the Kudos program to earn points and save your progress.

Deleted user Avatar
Deleted user

Level 1: Seed

25 / 150 points

Next: Root

Avatar

1 badge earned

Collect

Participate in fun challenges

Challenges come and go, but your rewards stay with you. Do more to earn more!

Challenges
Coins

Gift kudos to your peers

What goes around comes around! Share the love by gifting kudos to your peers.

Recognition
Ribbon

Rise up in the ranks

Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!

Leaderboard

Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,556,270
Community Members
 
Community Events
184
Community Groups

How to add validation for "Issue" which is right below the "Linked Issues" field?

Hi, 

I wanted to check the linking issue has a correct custom field value.

i.e. I have custom field 'Feature Type' and values "Product Feature" and "Technical Feature" on the linking issue and now I want to validate this issue on the other issue which going to link and contain Product Feature or not.

Example: Test112.PNG

On the create screen, "GTN-28761" which is going link to another issue and I want to add validation that GTN-28761 has a value of Product Feature or not to show here (another issue create screen).

Thanks

2 comments

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 06, 2017

In the validation phase of the create transition you will have to check if the custom fields have required values on the linked Issues or not.

How to fetch custom field value (since you already have issue Id of the linked issue thus you can get issue object using IssueManager)

https://community.atlassian.com/t5/Jira-questions/How-to-get-the-custom-field-value-using-by-groovy-script/qaq-p/385870

Code snippets to parse/get info of linked issues (answer form chris duffy)

https://community.atlassian.com/t5/Jira-questions/Validator-script-to-check-status-of-all-linked-issues-before/qaq-p/427966

Tarun Sapra
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
Dec 06, 2017

Also, the above samples work if you have script runner plugin installed.

Hi Tarun,

Thanks for your reply,

Yeah I have script runner plugin installed in my Jira.

Thanks

Hi Tarun,

Can you please help me to get linked issue custom field value?

I am getting confused there.

Thanks

Hi Tarun,

I tried this below code, did not work.

I'm a beginner for this Jira thing could you please help me.

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.issue.link.IssueLinkManager
import org.apache.log4j.Category
import com.atlassian.jira.issue.link.IssueLink;
import com.opensymphony.workflow.InvalidInputException
import com.atlassian.jira.ComponentManager;
import com.atlassian.jira.issue.CustomFieldManager;
import com.atlassian.jira.issue.fields.CustomField;
import com.atlassian.jira.issue.IssueManager;
import com.atlassian.jira.issue.Issue;

IssueLinkManager linkMgr = ComponentAccessor.getIssueLinkManager()

def customFieldManager = ComponentAccessor.getCustomFieldManager()
//custom field of linking issue
def cField = customFieldManager.getCustomFieldObject("customfield_18815")

def cField1 = customFieldManager.getCustomFieldObject("customfield_18813")
def cFieldValue1 = issue.getCustomFieldValue(cField)

for (IssueLink link in linkMgr.getInwardLinks(issue.id)) {


if ( (cFieldValue1.toString().contains("Product Feature")) && !(link.getSourceObject().getCustomFieldValue(cField).toString().contains("Product Feature")) ) {

invalidInputException = new InvalidInputException("Linked issue " + link.getSourceObject().getCustomFieldValue(cField) + " is not having right value")
throw invalidInputException
}


}

Comment

Log in or Sign up to comment