I'm using Adaptivist's Scriptrunner for Jira Cloud to create a behaviour that will set the Description field to a default template on the create screen when creating specific tickets. The portion that I'm struggling with is how to write info panels into the description template so that they show like this on the create screen:
/*
* Note: You should run this script by selecting "On load" in the check box above.
* Note: Only run this example on the Create View as it may overwrite the description field value if run on the issue view.
*/
/*
* Use the format below if your description field is set to use the DEFAULT Text field renderer
*
* const descriptionValue = getFieldById("description").getValue();
*
* if(!descriptionValue.toString()){
* getFieldById("description").setValue('As a <>type of user<>\n I want to <>achieve some goal<>\n So that <>some reason is fulfilled<>')
* }
*/
/*
* Use format below if your description field is set to use the WIKI field renderer
* TIP - To build up the required Atlassian Document format use the Atlassian tool at:
*/
const descriptionValue = getFieldById("description").getValue();
// If description field is wiki markup access the content property
if (typeof descriptionValue !== "string") {
const descriptionValueContent = descriptionValue.content.toString();
if (!descriptionValueContent) {
getFieldById("description").setValue({
"version": 1,
"type": "doc",
"content": [
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "As a ",
"marks": [
{
"type": "strong"
}
]
},
{
"type": "text",
"text": "<type of user>"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "I want ",
"marks": [
{
"type": "strong"
}
]
},
{
"type": "text",
"text": "<to achieve some goal>"
}
]
},
{
"type": "paragraph",
"content": [
{
"type": "text",
"text": "So that ",
"marks": [
{
"type": "strong"
}
]
},
{
"type": "text",
"text": "<some reason is fulfilled>"
}
]
}
]
})
Any help here is appreciated, thanks!