Good day,
I have created a Scriptrunner Behaviour to fill the field "Description" with a text template when a issue type "Request" is created:
- Guide workflow is adapted
- Initialiser is empty
- Optional/Writeable/Shown not changed
- Conditions changed to Workflow Action "Create"
and the server side script field is filled with the usual script to add text to the description field.
My issue:
- In JIRA I click "Create" to create a new issue.
- The ticket type is set to "Request" because this was the type of the last issue typ I've created.
- The description is filled by default with the server side script of the Behaviour.
- But I want to create a story, so I change the issue type to story.
- Problem now: The issue type is changed, but the description template remains.
My expection:
When I change the issue type the description field should be empty again.
I hope someone has an idea to fix that :-)
Thank you!
Hi @AB
Quick question, have you edited the default Description template before changing the issue type?
If so, then the template will not be removed. This is an expected Behaviour.
However, if you switch from the Request issue type to another issue type without updating the Description template, the Description field will be cleared.
If you are currently using a ScriptRunner version before 6.26, I would advise you to update it to the latest release as there was a bug fix related to this issue.
For more information, you can visit this bug report SRJIRA-3970 as well as SRJIRA-5276.
Before version 6.26, the description field template will not be cleared when switching issue types, even if no modifications were made to it.
I hope this helps to answer your question. :)
Thank you and Kind Regards,
Ram
Hi @AB
The approach you are taking in your comment below will not work.
Suppose you still intend to clear the Description field even though the template has been updated. In that case, you will need to create a separate behaviour configuration and specify the project you do not want the template to display.
And, in the Initialiser, you will need to include this code:-
def description = getFieldById("description") if(actionName == "Create") { description.setFormValue("") }
This is the workaround that I have provided in the SRJIRA-3970 ticket.
I hope this helps to answer your question. :)
Thank you and Kind Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @AB
Glad to hear the solution worked for you. :)
Please accept the answer.
Thank you and Kind Regards,
Ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello @Ram Kumar Aravindakshan _Adaptavist_
i have the same issue but in jira cloud
this is my script :
------START SCRIPT------------------
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @AB Welcome to Atlassian Community!
You have to define value for other issue type using else as well otherwise description remains for other issue types.
Put else condition here :-
def desc = getFieldById("description")
else {
desc.setFormValue("")
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi!
My script looks like this:
def desc = getFieldById("description")
def defaultValue = """\
(text)
""".stripIndent()
if (!desc.getValue()) {
desc.setFormValue(defaultValue)
}
So - would this be correct?
def desc = getFieldById("description")
else {
def defaultValue = """\
(text)
""".stripIndent()
}
if (!desc.getValue()) {
desc.setFormValue(defaultValue)
}
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.