Forums

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

Build structure using issue picker Script Field

Poojaa Sudhakaran
Contributor
March 29, 2020

Hello There,

I have a scenario where I need to build a structure using issue picker field.

I have 2 issue types : Initiatives and Epics. Epics are linked to Initiatives using Initiative Link, which is a Script runner Issue picker field.

My goal: In a structure, I need to display all the initiatives and Epics under the initiatives.

What I have tried so far: I have inserted epics and grouped by Initiative link as Text attribute. The problem with this approach is that, instead of the issue, a long text string of the issue something like "IssueRefJsonBean" is getting displayed.

Is there any other way in achieving this?

 

Thanks a ton!

Poojaa

4 answers

2 votes
Egor Tasa [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Thanks, Poojaa,

Here is my suggestion. Try changing the grouping formula to: MID(Notes, SEARCH('summary">', fieldName)+9, SEARCH('</span>', fieldName)-SEARCH('summary">', fieldName)-9)

This is not very elegant, but I cannot figure out a better way. Note, you still need to change Manual Specification of the fieldName.

Regards,
Egor

Poojaa Sudhakaran
Contributor
March 31, 2020

Thanks for your time and effort Egor,

I'm facing an error in the formula which you provided, Not sure what the "Notes" field is for as I'm receiving an error stating "some of the used variables are not defined". Could you please give me some details on that - please find screenshot below.

test.png

Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Hi @Poojaa Sudhakaran ,

I think @Egor Tasa [ALM Works] has probably used the Structure Notes Column for having a column with the same value than what it is returned by your Issue Picker field.

Just substitute Notes with the name of your custom field with no blankspaces. I think it is Initiative Link, so use inititativeLink in Egor's formula.

Egor Tasa [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
April 1, 2020

Hi Poojaa,

Ignacio is right, I was experimenting with Notes column and forgot to replace its first instance.

Regards,
Egor

0 votes
ayala nayman August 17, 2020

Hi all 

not sure if it still relevan but here is what I did to solve this:

first create a column formula , general .and display the script runner field.

you will see a text like "IssueRefJson,,,,

so the next step is to take this text and manipulate it to show whatever you need , summary/issue key/status. u can use strcture EXPR langugae ,

preform a SEARCH and SUBSTRING to extract your value. 

for example I wanted to extract summary.

so I added another formula column , wiki type that will return text of the summary.

and my formula was 

with SummaryStart = SEARCH("summary=",myfield):

with SummaryEnd = SEARCH(",status",myfield):

SUBSTRING(myfield, SummaryStart+7,SummaryEnd-1)

0 votes
Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Hi @Poojaa Sudhakaran ,

As Issue Picker fields also put an issuelink in place, I'd suggest following these steps (I'll assume that the type of said issuelink is "relates to", although it might need to be adjusted for your case):

  1. Enter the Structure Board and add an Insert Automation based on the following JQL:

    type = Initiative AND issueFunction in linkedIssuesOf("type = Epic AND 'Initiative link' is not EMPTY", "relates to")

  2. Add an Extend Automation based on the issuelink type in place (ie: Relates > relates to, the bidirectional one)

  3. Add a Filter Automation based on this JQL, to be applied just at this level:

    type = Epic AND 'Initiative link' is not EMPTY

Hope I've remembered the correct names for everything, as I've not tested it right now, but have managed a similar scenario.

By the way, there's a chance that you do not need to include 'Initiative link' is not EMPTY neither in the Insert or the Filter automations' JQLs (steps 1 and 3), as there's a high chance that you wanted to include all Epics linked to a specific Initiative through that issuelink type, even if the "Initiative link" of the Epic were empty.

Hope it helps.

Poojaa Sudhakaran
Contributor
March 31, 2020

Thanks for the inputs @Ignacio Pulgar ,

I tried implementing your approach but somehow couldn't fetch the issuelink that is being created using Issue picker field. Please note that I'm using ScriptRunner issue picker field and I tried fetching all the issue links associated to an issue but couldn't find any links even if the issue had value in the Issue picker field.

I couldn't find an option to set link type in scripted field configuration page. Is there any way where I can configure the link type?

Thanks,

Poojaa

Ignacio Pulgar
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Oops! My fault! Issue Picker fields do not add issuelinks natively.

I must have been confused with the way other kind-of "issue pickers" work, like vLinks or Easy Links for Jira.

With no need for additional addons, maybe a ScriptRunner's Script Listener could be set to also add an issuelink with the issues added to an Issue Picker field.

Such a script would be glorious and should be added to the Adaptavist Library.

Any brave script coders over here? :)

Summoning @Nic Brough -Adaptavist- ! Nic, would it be a feasible script?

Thanks and regards!

0 votes
Egor Tasa [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Hi Poojaa,

Structure does not support grouping by an arbitrary issue field at the moment, but we can try some approaches that may help you. One thing to check is group by Text Attribute>Formula, in the formula enter the name of the field (without spaces if there are any), then click on the variable name at the bottom of formula panel and select Manual Specification, where you can replace "format": "text" with "format": "html". Result may need some additional parsing, but we'll need to know what it is before applying parsing rules.

Regards,
Egor Tasa

ALM Works

Poojaa Sudhakaran
Contributor
March 31, 2020

Thanks Egor.

I've tried your approach and I got html code snippet as shown below.

<div class='module toggle-wrap'> <div class='mod-content'> <div class='links-container'> <dl class='links-list' style='padding-left: 0px'> <dd class='srissuepicker' s..

I'm not able to view the complete snippet. Kindly help me in resolving this.

Thanks,

Poojaa

Egor Tasa [ALM Works]
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
March 31, 2020

Ok, let's try the following, Poojaa,

Add a column to your structure with the same approach: Formula>field_name>Manual specification, change to html. In formula column, you should be able to see the full snippet (click on vertical ... to see the full text).

Regards,
Egor

Poojaa Sudhakaran
Contributor
March 31, 2020

Thanks Egor, please find the screenshot below.

 

test.png

Suggest an answer

Log in or Sign up to answer