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,456,314
Community Members
 
Community Events
176
Community Groups

Hyperlink with scriptrunner

Hi,

our customer want to use behaviours to prepopulate a hyperlink in the description field.

Please can you help with the code?

def desc = getFieldById("description");
def text = "hier";
def hyper=text.link("http://google.com");

def defaultValue ="""Instruktionen sind """+ hyper+""" zu finden""";
if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}

I get an error on line 3: "Cannot find matching method" and no output

 

1 answer

0 votes

Hello @Ireen Klein_Actonic

You should do it via html tags, like this

def desc = getFieldById("description");
def hyper="<a href=\"http://google.com\">google</a>";

def defaultValue ="""Instruktionen sind """+ hyper+""" zu finden""";
if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}

Hello @Mark Markov,

thx for your answer. Unfortunately it doesn't work.

The output/the prepopulated text in description field is:

Instruktionen sind <a href="http://google.com">google</a> zu finden.

 

What have I to change?

Oh, its description.

Try this

def desc = getFieldById("description");
def hyper="[google|http://google.com]";

def defaultValue ="""Instruktionen sind """+ hyper+""" zu finden""";
if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}

And make sure that wiki render is enabled.

How to work with wiki markup.

Like Ahmed Arslan likes this

@Mark Markov , It worked for me. Thanks

@Mark Markov

Do you know if there is an alternative way? as we are not allowed to enable wiki render because of a security risk

Hi @ChristopherChilds  you can use the field description to have the URL added in field's description IMO.

Like ChristopherChilds likes this

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events