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

How to inject javascript when behaviour (scriptrunner) is used ?

Edited

Hi,

I wanted to inject html in a custom field. I got a solution that is working. The solution is about using html in the description of the custom field to inject some javascript.

However, the solution is working unless the custom field is bind by a behaviour (scriptrunner). I have the custom field on several screen. On all standard screen, where no behaviour can be triggered, the injection work. But on the screen that is important to me, the injection does not work and it seems caused by the fact that there are scripted behaviour running at the same time on the screen.

Does anyone get the same issue ? Any idea where can i put my javascript ?

Regards,

Laurent

2 answers

1 accepted

1 vote
Answer accepted

OK !!

That was a tricky issue.

Like i said, it had nothing to do with Behaviours (scriptrunner).

Actually it seems that it's a normal behaviour of JIRA. I firstly updated the description of my field in Administration > Issues > Custom fields. It seems that the change made here affect only the default field configuration.

My project was on a different field scheme, so the description in Administration > Issues > Custom fields > My Field, was not the same that the description in Project > Custom Field Configuration > My Field.

I just updated the description in my custom field configuration and it worked !

Any way to do this on the cloud version? 

0 votes

There may be a few things at work.

First, are you sure that this happens all the time when a Behaviour is running, or is it only when the Behaviour manipulates the description of a field using setDescription? I would expect the latter case to remove any custom code you've written, but not the former case. To test this, you could just create a simple behaviour that makes a different field in that context read-only, then disable your existing behaviours. If you can't reproduce the problem, you should check your behaviour scripts for calls to the setDescription method on a field (or myCustomField.description = ).

One potential workaround would be to put your custom javascript into a Web Resource, though that might be overkill for your needs.

I was sure that behaviour was the cause but i was wrong.

I did some tests:

Let's say that Project A is were the injection don't work and Project B is my test project.

I just copied the behaviour of A on B and the javascript injection worked.

Besides i deleted the behaviour of A and i mapped the behaviour of B on A and B.

The result is that it still work on B and it still don't work on A. 

Therefore the issue does not come from the behaviour.

Suggest an answer

Log in or Sign up to answer
TAGS

Atlassian Community Events