How to set default ticket description using Scriptrunner Behaviour

rneill19 March 19, 2024

Hi!

I am trying to set a default description for tickets in certain projects using Scriptrunner Behaviours. I'm familiar with doing this in Jira Data Center but I'm not sure exactly how it works with Jira Cloud.

I found this script in Adaptivist's documentation:

 

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>"
}
]
}
]
})
}
}

I don't understand where I'm supposed to configure the custom text that I want to appear in the description. Can anyone help? Thank you in advance!

2 answers

0 votes
Nar Kumar C_ - Narva Software
Marketplace Partner
Marketplace Partners provide apps and integrations available on the Atlassian Marketplace that extend the power of Atlassian products.
March 20, 2024

Hi @rneill19 

I am a bit biased as I am also an app dev, but personally I do not recommend ScriptRunner Behaviours for issue templates. It comes free with the main ScriptRunner app, but it is super cumbersome and has more problems than it's worth IMO.

If you want issue description templates on create screen, I would suggest alternative apps like ours:

Issue Templates Pro for Jira - Summary & Description Templates

Feel free to reach out to us if you need any help.

0 votes
Harsh
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.
March 20, 2024

Hi @rneill19 

I would suggest to automation for the same, instead of scriptrunner.
But if you do want to use the scriptrunner would you mind explaining -

- if the description is to be set after the ticket is getting created and if based on some conditions or you want a general description to be set when the issue is created.?

- Or you want a default description to show at the time of creation?

Thank you.

rneill19 March 20, 2024

I want the description template to show on the create screen! Thanks

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
CLOUD
PRODUCT PLAN
STANDARD
PERMISSIONS LEVEL
Site Admin
TAGS
AUG Leaders

Atlassian Community Events