Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

New line in Behaviour text using Dynamic Form on Service Desk Portal field?

WW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2021

There are a lot of layers to this one, so please bare with me.

Everything works great up until the point I try to view the text in a JSD Request type field.

  • I've got a script saved as a file in the Jira ScriptRunner Script Editor.
  • The Script has code to create a dynamic form short text field.
  • That field is used to enter the default value for the Description field in a Behaviour.
  • I set the mappings to both "(All issue types)" and "(All request types)" for a project, just in case.

Here's what I have for the Behaviour's value that is passed in the short text field, and you can see that the script file has a green dot, so it's good.

defaultDesc.png

 

When I create an issue as an Agent (ie in regular Jira view), the text I entered for the default value works when I use \\ as a line break.

agentView.png

 

However, when the same issue type is created as a request through the JSD portal, I get this:

portalView.png

 

In summary for characters that (should) create new lines:

Works in Agent View:

  • \\

Does not work in Portal View:

  • \\

Does not work in Agent View or Portal View:

  • <p>
  • \n
  • \r\n

Is there any character or character combinations I could use to get a new line in a JSD portal request field by setting the default value through a ScriptRunner Behaviour using a dynamic form short text field with a script?

 

Thank you in advance!

 

PS I've got these versions:

Jira v8.5.9

JIRA Service Desk Application v4.5.9

ScriptRunner for Jira v6.11.0

 

2 answers

1 accepted

Suggest an answer

Log in or Sign up to answer
2 votes
Answer accepted
Peter-Dave Sheehan
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
February 3, 2021

I'm not clear on why \\ works in jira.

But I'm pretty sure that there is some escaping going on such that \n is interpreted as \\n etc.

I find that in my testing if you do something like this, it works in both JIRA and JSD:

2021-02-03 13_00_51-Edit Behaviour_ QSM - Incident portal hide fields on create.png

WW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2021

Hooray! I think it works! :)

This:

defaultDesc.png

Became this:

in the request type in the portal view

portalViewWorks.png

and this in the Agent view

agentViewWorks.png

Thank you!!

0 votes
Ravi Sagar _Sparxsys_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2021

Wow, thank for explaining this so nicely :) Let me check and get back to you.

WW
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
February 3, 2021

Hi @Ravi Sagar _Sparxsys_ ,

I tend to be pretty detail oriented. :)  I also tend to get a lot of vague Jira tickets and know what it's like to try to answer them.  I figure (hopefully!) the better the question, the quicker and better the answer.

Thank you for looking into this for me!

TAGS
AUG Leaders

Atlassian Community Events