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!
@rneill19 Hello.
I will try to help you.
I am also use this script to set my own description.
In code I will change some parts for you to understand where to change value.
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": "YOUR PARAMETERS",
"marks": [
{
"type": "strong"
}
]
},
{ \\ you could delete this part and some lines under
"type": "text", \\
"text": "ONLY IF YOU NEED IT" \\
} \\
] \\
}, \\
Here is an example of one fully working script:
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.