Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Scriptrunner behaviour: how do I set field to text with New Lines (carriage returns)?

Sabine Van Regenmortel
Contributor
February 24, 2023

Hi,

I have a checkbox, and depending on whether it is filled in, I want to show a multi-text field with a table.

The hiding and showing works, but the setFormValue does not work with the carriage returns for the table.
I tried already with &&'\n'&&, but then the text is filled with 'true'.

 

So this is my behaviour server side script on the checkbox field called cosmetics:
def cosmetics = getFieldById("customfield_18787")
def cosmeticstable = getFieldById("customfield_18788")

cosmeticstable.setHidden(true);

if(cosmetics.value != null){
cosmeticstable.setHidden(false);
cosmeticstable.setFormValue('|| ||Prep.||PI.Prod.||Press||Labo||Eval||Description||
||Coating quality| | | | | | |
||Scuffs - pinholes| | | | | | |
||Substrate quality| | | | | | |
||Visual control| | | | | | |')
}

Screenshot 2023-02-24 at 13.14.07.png

1 answer

1 accepted

3 votes
Answer accepted
Sabine Van Regenmortel
Contributor
February 24, 2023

OK, I found it. It was just \n without quotes, so:

def cosmetics = getFieldById("customfield_18787")
def cosmeticstable = getFieldById("customfield_18788")

cosmeticstable.setHidden(true);

if(cosmetics.value != null){
cosmeticstable.setHidden(false);
cosmeticstable.setFormValue('|| ||Prep.||PI.Prod.||Press||Labo||Eval||Description||\n||Coating quality| | | | | | |\n||Scuffs - pinholes| | | | | | |\n||Substrate quality| | | | | | |\n||Visual control| | | | | | |')
}

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
8.22.6
TAGS
AUG Leaders

Atlassian Community Events