I am working on a task where I am setting the URL in URL Field using a custom script.
Here is my script
Here is my field
I am able to set the value to the field but I can not click it. Here is my screen:
How do I make my field clickable? I don't want users to edit this URL. Just want them to click it.
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
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)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Ohey @Jamshaid so URL fields are only *clickable* when you are VIEWING a ticket, not in the Transition like your screenshot.
(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:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
@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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
[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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
what do you mean by "proper renderer is set"?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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...
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.