I have some groovy files inside a JIRA plugin developed by our team. I install that plugin into JIRA and make scripted fields pointing to that groovy files, using the ScriptRunner plugin. Everythink works fine except for the fields rendering. If I view those fields on a view issue screen, and I refresh it with F5, sometimes the fields render wrong, being Spanish characters as ñ, á, é, í, ó, ú, rendered as question marks. I know that it is a character encoding problem.
The only thing I don't understand is that ON SUCCESSIVE SCREEN REFRESHINGS WITH F5 SOMETIMES THE FIELDS RENDER WELL AND SOMETIMES WRONG. Why the hell is this happeing? Really the browser must be kidding me. Does the character encoding change in successive screen refreshes? What kind of joke is this? Shouldn't the same character encoding be used always? Really I think it has no sense at all that the character encoding changes by pushing F5. I see it as a nasty joke. What do you think?
Please add this piece of code on the top of your script (below the import section) and try. It might be a browser cache issue.
enableCache = {-> false}
Thank you. I will try it. Nevertheless, when I was testing the scripted fields, I am very sure that the browser cache was disabled. I always do that, it is an habit of mine.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
True! But there will be cache from the server end as well.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No it doesn't work. I am experiencing the same issue. In addition, when I am on the scripted fields management section there is a preview button to see how would the field render for a certain JIRA issue, and it always shows well. It is a problem that only shows on the view issue screen.
Really I can't understand anything. This has no sense. At all. No sense. What a hell.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
A few questions please.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It happens for all scripted fields.
They are of type text.
The code of an scripted field:
import java.text.DateFormat import java.text.SimpleDateFormat import com.atlassian.jira.issue.CustomFieldManager import com.atlassian.jira.component.ComponentAccessor def dateFormat = new SimpleDateFormat("dd/MM/yyyy") as DateFormat def customFieldManager = ComponentAccessor.getCustomFieldManager() def closeCustomField = customFieldManager.getCustomFieldObjectByName("Fecha y hora de cierre") def closeValue if (closeCustomField == null) { closeValue = null; } else { closeValue = issue.getCustomFieldValue(closeCustomField) as Date } if (closeValue) { dateFormat.format(closeValue) } else { "no ha sido cerrada aún" }
Nearly at the bottom, when it says a phrase in Spanish with the character ú, is where the problem happens.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Also I have a cache problem as you said, because I am trying to make changes on the fields and I am unable to get those changes reflected on the view Issue screen although I disabled cache on the groovy files by putting your code below the imports.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Are trying to set the value "no ha sido cerrada aún" to closeValue? I don't understand your last else loop. Please explain what you are trying out.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
If the custom field that retains the closing date of the issue has no value, then I return an String for noticing the user.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I don't know how to say this but I restarted JIRA and I am utterly unable to reproduce the problem. It never happens now. It seems that simply JIRA gone crazy, which is not a new thing...
Something that really grinds my gears is that when developing for JIRA it is very frequent that I have lots of troubles that later disappear magically with a restart or something like that, in a way that I never know what is the cause, or if I done something wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
No need to be quite so dramatic about it. UTF8 wasn't invented just to screw over Mikel Rodriguez.
What template is being used for the field, can you attach a screen cap of the script field config?
Can you make a simple script field with the script:
"ñ, á, é, í, ó, ú"
and see how that renders?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
XD XD well at least I had some laughs. You have read my mind. Character encodings have screwed over me since the beginning of times... It is a problem of which I have always been unable to get rid of.
I don't know how to say this but I restarted JIRA and I am utterly unable to reproduce the problem. It never happens now. It seems that simply JIRA gone crazy, which is not a new thing...
Something that really grinds my gears is that when developing for JIRA it is very frequent that I have lots of troubles that later disappear magically with a restart or something like that, in a way that I never know what is the cause, or if I done something wrong.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Spend the day sharpening your skills in Atlassian Cloud Organization Admin or Jira Administration, then take the exam onsite. Already ready? Take one - or more - of 12 different certification exams while you’re in Anaheim at Team' 25.
Learn more
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.