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,465,353
Community Members
 
Community Events
176
Community Groups

URL field is not clickable

I am working on a task where I am setting the URL in URL Field using a custom script. 

Here is my script

 

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption
 
def customFieldManager = ComponentAccessor.getCustomFieldManager()
def issueManager = ComponentAccessor.getIssueManager()
def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()
def cf = customFieldManager.getCustomFieldObject("10902")//url
 
issue.setCustomFieldValue(cf,'<a href="https://uat.cybersage.us/#/analysis"></a>')
issueManager.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)


 

Here is my field

as.pngI am able to set the value to the field but I can not click it. Here is my screen:

sc.png

How do I make my field clickable? I don't want users to edit this URL. Just want them to click it.

 

3 answers

1 accepted

1 vote
Answer accepted
Darryl Lee Community Leader Dec 06, 2022

Hi @Jamshaid -

I believe the value for the URL should JUST be the URL: https://uat.cybersage.us/#/analysis

You should not need to include the HTML with the <a href...></a>.

@Aron Gombas _Midori_  @Darryl Lee 

I have updated my code and the value is editable in the field but not clickable

 

as.png

Here is the code I am using

import com.atlassian.jira.component.ComponentAccessor
import com.atlassian.jira.event.type.EventDispatchOption

def customFieldManager = ComponentAccessor.getCustomFieldManager()

def issueManafer = ComponentAccessor.getIssueManager()

def userManager = ComponentAccessor.getUserManager()

def user = ComponentAccessor.getJiraAuthenticationContext().getLoggedInUser()

def userCf = customFieldManager.getCustomFieldObjectByName("URL")

issue.setCustomFieldValue(userCf,'https://uat.cybersage.us/#/analysis')

issueManafer.updateIssue(user, issue, EventDispatchOption.DO_NOT_DISPATCH, false)

 
Darryl Lee Community Leader Dec 06, 2022

Ohey @Jamshaid so URL fields are only *clickable* when you are VIEWING a ticket, not in the Transition like your screenshot.

urlfield.jpg

(That screenshot is from Cloud, but Server/DC presents similarly.)

If you are wanting a clickable URL in a transition screen... I think you can do that in a Field Description, so you wouldn't be able to have it change per issue.

Since you are setting the URL with a script, maybe you don't want the URL to be editable at all during transitions? In which case, I would maybe remove it from that transition screen?

I guess more generally, I should ask, what exactly are you trying to do here? Here's some questions:

  1. Where, or how are you getting the URL? Is it automatically generated somewhere else in your script?
  2. When do you want people to click on it? Do they need to reference the URL when they are in a middle of a transition such as "Start work" like you took a screenshot?

@Darryl Lee Thanks for such a detailed response. The URL is static. 

When people reach the transition "Start Work", they are supposed to click on the URL(which is static and the same for every Start Work screen) and go to that site and perform some tasks linked to the WorkFlow through REST API. 

I have tried setting it as default value and it was still editable, due to which I tried adding it using Script thinking of it might make a difference or there might be a programmatical way to do it.

 

I just want that URL to be added to the URL field and make it clickable. There is no issue in setting it as a default value.

Hope I am able to clarify it.

Darryl Lee Community Leader Dec 07, 2022

AHHH, ok, you just want THE SAME URL on every Start Work screen, and maybe some text telling people what to do with that URL?

You should use a Message Custom Field, which can include HTML, like your URL. (so you will need include the <a href...</a> tags.)

There is a little documentation on this field here:

https://ecosystem.atlassian.net/wiki/spaces/JTOOL/overview

And @Ravi Sagar _Sparxsys_ has a great video explaining how to implement one of these fields:

https://www.youtube.com/watch?v=Bz6541GhS4M

This should work much better.

1 vote
Darryl Lee Community Leader Dec 08, 2022

[Making this a separate answer]

Now that I think I understand @Jamshaid 's requirements, to be able to put the same URL on every "Start Work" screen, I realize this would be better implemented as a Message Custom Field.

Message Custom Fields can include HTML, like your URL. (so you will need include the <a href...</a> tags.) They can also include additional instructions like: "go to this site and perform tasks linked to this issue".

(I will note that this workflow is a little odd. If they are seeing this message and link in the "Start Work" transition screen, how will they be able to see/work on the linked tasks?)

At any rate, there is a little documentation on this field here:

https://ecosystem.atlassian.net/wiki/spaces/JTOOL/overview

And @Ravi Sagar _Sparxsys_ has a great video explaining how to implement one of these fields:

https://www.youtube.com/watch?v=Bz6541GhS4M

This should work much better.

Hi
Thanks for giving so much of your time. We have followed another approach to show this field. We dropped the idea of showing it in a WorkFlow and simply showed it in the main screen of the issue view where the URL field worked fine.

Thanks a lot 

Like Darryl Lee likes this
1 vote

The value should not be in HTML format, but in the plain text storage format. Then, it is the renderer configured for your custom field which converts it to HTML.

Consequently, you should just:

issue.setCustomFieldValue(cf,'https://uat.cybersage.us/#/analysis')

and make sure that the proper renderer is set! 

what do you mean by "proper renderer is set"?

Oh, I just realize that you're using the "URL" custom field type.

Renderers are configurable only for multiline text type custom fields, I think. Ignore my previous comment about the renderer.

I'm not sure why it doesn't work. The value object for that CF type should be a String with a valid URL (formatted correctly). And it seems your value satisfies this...

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events