Hello Team,
We are using behavior in one of our Jira project for Bug Issue type. We are using a script in the Description field to get predefined data.
After creating the issue whenever we are trying to edit an existing issue, the description gets reset to the default text and all user filled in the text is deleted.
I am attaching my script here. Please suggest.
def desc = getFieldById("description")
def issueType = getFieldById("issuetype")
def issueTypeVal = issueContext.issueType.name
if (issueTypeVal == "Bug") {
def defaultValue = """*<Description>*
*Steps to reproduce:*
*1.*
*2.*
*3.*
*Actual result:*
*Expected result:*""".replaceAll(/ /, '')
if (! underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
} else {
desc.setFormValue(" ")
}
Hello @[deleted]
If you need different logic on create screen and edit screen, you must restrict code execution depending on current action (create or edit).
function that helps you to achive that
if (getActionName() == null) // for edit screen
if (getActionName() == "Create") // for create screen
Hi @Mark Markov,
I used your function in our code we achieved our end result only one behave a noticed. When I am moving to different issue type at the time of issue creation (Bug to some other issue type) behavior is not going, I have to click on the Visual tab then the description values are vanishing in the creation screen.
Can you please suggest?
Shubhanshu Trivedi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
It seems like you place your code in Initialiser Function
Code in this function runs only once form load. Map your code to Issue Type field and it will be run every time field changes. Like this
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Can you send me a screenshot of your behaviour config?
Looking for this screen:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I cannot reproduce your issue.
What version of SR and JIRA are you on?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi @Roland Holban (Adaptavist),
SC-5.3.26
Jira-7.2.13
Try to edit other existing issues types in your projects not only Bug issue type.
BR,
Shubhanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
When I edit other issue types the description gets cleared completely because of:
} 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.
Yes, Roland. I am using this to omitting description when I am changing the issue type at the time of issue creation. If I'll remove these lines then description text is the default for all the issue types.
Shubhanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I tried downgrading my SR and JIRA to your specific versions and I still cannot seem to reproduce.
If I edit an existing issue of issue type not bug, the description gets cleared correctly because the else clause triggers:
} else {
desc.setFormValue(" ")
}
If I try to edit an existing issue of issue type bug, the description doesnt clear because this checks for an already existing description before filling:
if (!underlyingIssue?.description) {
Do you you have any other behaviours that might be doing this?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.