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:
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
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,
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
}
}