I have a custom field that assosiciates a jira issue with another. I am creating a Script Field and for that I need the id of that jira issue that is assosiacted, but "issue.getCustomFieldValue(customField)" returns an Object object, I can´t get the id for that.
Is ther a way to parse it into a JiraIssue type? Can I get the id of that issue via another way?
Thanks.
Welcome to the Atlassian Community!
This suggests that your customField may be a select list, although I would expect that to return an object of type "option", not just "object". Getting an "object" suggests that it is a custom field of a non-native type, not a standard Jira issue field.
If that is the case, you'll need to consult the docs for the app that is providing the field to find out how to interrogate the object for the data you need.
I would also question why you're doing this, when you could be using issue links to associate two issues together (they're easier to work with in code as well...)
Yeah, the custom field is a select list, the customer wants to automate the process of linking 2 issues, whenever you select a issue in this custom field, the 2 issues must link together.
Could this custom field be configure so that it returns an IssueType? Or the only way is via code?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No, select lists are made of options.
You can get the name of an option with issue.getCustomFieldValue(customField).getName()
Seems odd to me to want to link an issue to another one by using a select list, when the issue link function already does it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
That is what I asked them, the answer was that this custom field makes a child reference to an issue in another issue. They want the child to be linked to the parent issue automatically
My approach was using ComponentAccessor.getIssueLinkManager().createIssueLink(sourceIssueId, destinationIssueId, issueLinkTypeId, sequence, user)
Only things I´m lacking is "destinationIssueId" which I´m trying to get retrieving the value of the custom field. Still wondering what sequence even is...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ok, on both a technical and procedural level, the field does not make a child reference. That is done with Sub-tasks, Issues, Epics, and any other issue levels you put in a hierarchy above Epic. This field is never going to act in the way a "parent" field will.
But hey, if that's what they think they want to do, it's not for us to refuse, we can only question why they're botching something this way, explain there are better ways to do it, and then do what they think they need if they don't adopt the better approaches.
The field contains some reference to another issue. The value in the field is not an issue, so you can't use it in your "createIssueLink" call.
You'll need to ask them how the field options relate to the issues they represent. Issue key? Issue id? Another field on an issue?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.