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,370,109
Community Members
 
Community Events
168
Community Groups

JMWE - Set issue's field to parent's key (as a hyperlink)

Hi,

I'm trying to set the issue's field to its parent's url.

I can get the key of parent but I cant reach the parent's url.

Parent: TD-10

Sub-task: TD-11

I want "TD-10" in TD-11's screen as a hyperlink.

I tried below,

JMWE.jpg

Can anyone help?

 

Thanks

2 answers

1 accepted

1 vote
Answer accepted
Alex Koxaras Community Leader Oct 05, 2021

Hi @Aslıhan Paksoy and welcome to the community!

Which field are you trying to place, and where exactly? You want to place the parent's URL on the e.g. summary of the child issue? 

Hi @Alex Koxaras , I have a text field in the sub-task , I'm trying to place the parent's URL on this field.

Alex Koxaras Community Leader Oct 05, 2021

I would use:

https://YOURINSTANCENAME.atlassian.net/browse/{{ issue.fields.parent.key }}

But, I would definitely try to find another way to get the base url from JMWE. Give me a couple of minutes.

And I would add a condition for that post function to run only if parent issue exists (unless you have this PF on a workflow used only by a subtask) 

Does the field have to be a text field or url field?

Alex Koxaras Community Leader Oct 05, 2021

I would make it a URL field.

I wrote in JMWE


[{{parentIssue.fields.summary}}|https://myinstance/browse/{{parentIssue.key}}]

I'm trying to insert an hyperlink; summary of parent will be seen as link alias

:( url field gives an error:
customfield_10201: Specify a valid URL for the Custom Field

Alex Koxaras Community Leader Oct 05, 2021

Yes, because this is not a valid URL. You are trying to enter a URL as a [MYSUMMARY|https://myinstance/browse/YOURKEY]

The valid URL would be only the code I've given you (starting with https). If you want to include the summary and the wiki notation, then use a text field.

I have tried this,

jmweTest.jpg

But in the issue view, this is the result, summary and key is not shown
jresult.jpg

Hi @Aslıhan Paksoy ,

the parentIssue variable is only available in post-functions that operate explicitly on the parent issue. Here, the post function operates on the current issue (the issue on which you're setting the field value). To access the current issue's parent, you need this:

[{{issue.fields.parent.fields.summary}}|URL/browse/{{issue.fields.parent.key}}]
Like # people like this
Alex Koxaras Community Leader Oct 05, 2021

Do what David told you :)

@David Fischer _Appfire_ hi, values are okay but now the link is not clickable :(

jwme.jpgjwmelink.jpg

Hi Aslihan,

The field should've "Wiki Style Renderer" for the value to be displayed as expected.

However, in the new issue view, Short text only supports plain text, so the renderer settings don't apply. Use the Paragraph custom field for rich text like links to URLs.

Thanks,

Suprija

@Suprija Sirikonda _Appfire_ I have created another field like you said but it did not work,

rich.jpg

Hi @Aslıhan Paksoy ,

Does the field have "Wiki Style Renderer"? 

What's the type of the field and on which view(new/old) you're seeing this?

Regards,

Suprija

Okay, I have changed my field's renderer. Unfortunately it was default text renderer. Sorry and thank you all for helping me :)

Like Alex Koxaras likes this

Great to hear that!

Hi Aslihan,

To get the URL you will need to use the following URL:

{{null | serverInfo | field("baseUrl")}}

For more details please check our documentation linked below:

 So your template in Set issue field post function should be something like this:

{% if issue.fields.parent.key %} [{{issue.fields.parent.key}}|{{ null | serverInfo | field("baseUrl")}}/browse/{{ issue.fields.parent.key }}] {% endif %}

result.png

Hope it helps and let us know how it goes.

I cant find Groovy option in JMWE :(

Hi Aslihan, 

I just noticed you are using JMWE for Jira cloud, I have updated the above solution accordingly. Let us know if you were able to get the parent issue URL.

Thanks, David's way have worked , but I will try this to

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events