ScriptRunner question

Durell Demartini March 22, 2024

We're using a Behavior to pre-populate some text of type "Notation" in the Description field, based on this document: https://jira.atlassian.com/secure/WikiRendererHelpAction.jspa?section=miscellaneous

We like the rendering, other than the fact of no white space between, so I've been trying to figure out how add a new line/blank line between each item. 

I've tried the following to no avail:

  • Leaving an empty line between
  • \n
  • \\
  • \\\\
  • <br />

Screenshot 2024-03-22 125321.png


def desc = getFieldById("description")
 
def defaultValue = """

(i) *Summary*

(?) *Steps to Reproduce*

(-) *Actual result*

(+) *Expected result*

(-) *Which action blocks:*

(*) *Affected customer*

(*) *Test data*

(*) *Environments where reproduced (DEV, QAE, CAE, PROD)*


""".replaceAll(/    /, '')
 
if (!underlyingIssue?.description) { // <1>
    desc.setFormValue(defaultValue)
}

We're using ScriptRunner 8.1.0 on Jira DC 9.4.5.

Thanks in advance for any suggestion you can think of!

1 answer

0 votes
Durell Demartini March 23, 2024

So, I did figure out a way to add blank lines: by using multiple lines of "\\\\":

(i) *Summary*
\\\\
\\\\
\\\\
However, this seems to be at the cost of rendering a pop-up regarding "Preserving user responses" IF the issue type is changed.

According to ScriptRunner documentation (https://docs.adaptavist.com/sr4js/latest/features/behaviours#preserving-user-responses), this pop-up cannot be disabled. Perhaps the code to add the line is considered an "existing value," even though the "\\\\" renders as a blank line and is not visible via "Visual" of "Text," and thus, per the ScriptRunner Behavior documentation, a pop-up appears when you go to create an issue AND you happen to change the issue type.

Screenshot 2024-03-23 101758.png
If anyone is aware of a way to create spaces without triggering the pop-up upon the change of the issue type, please let me know. 

Suggest an answer

Log in or Sign up to answer