Hi Team,
I have written below script to add behavior in the description box.
def desc = getFieldById("description")
def defaultValue = """
h5.Initial situation:
h5.Activity:
h5.Expected result / target state:
h5.Monitored result / current state:
h5.Consequence (opt.):
h5.Workaround (opt.):
h5.Used logical or physical test data (opt.):
""".replaceAll(/ /,'')
if (! desc.getValue()) {
desc.setFormValue(defaultValue)
}
The problem is when I am going to create an issue in a project behavior is not coming in the visual panel in the description box and when I moving to text tab and removing one space from there and I moved to visual tab then the behavior is coming in the description box.
Can somebody help me to fix this issue?
Thank You
Shubhanshu Trivedi
Hey @[deleted]
First you'll want to limit it to a specific issuetype (that way it doesn't show up on all your create issue screens. unless you want it on all) I'm not exactly sure what problem you are having with the text tab & visual panel could you send a picture? Here's some code for the behavoiur.
/*
* Code to be placed as an initializer function
*/
// Get a pointer to the description field
def desc = getFieldById("description")
// Get a pointer to the issue type field and get its value
def issueType = getFieldById("issuetype")
def issueTypeVal = issueType.getValue()
// If the issue type equals issuetype ID
if (issueTypeVal == ****) {
def defaultValue = """
h5.Initial situation:
h5.Activity:
h5.Expected result / target state:
h5.Monitored result / current state:
h5.Consequence (opt.):
h5.Workaround (opt.):
h5.Used logical or physical test data (opt.):
""".replaceAll(/ /, '')
if (!underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
// If any other issue type ID is returned set the description to a blank value
} else if (issueTypeVal != ****) {
desc.setFormValue(" ")
}
Thanks for your help. I used the same code which you provided me still I am facing the same problem.
I'll explain you one by one step.
In above image, I logged in and I am creating an incident by adding the behavior in the description box and particular issue type, In the visual panel, behavior is not coming for the 1st time.
Now if I'll switch the text panel like below image behavior is coming and if I'll remove the backspace from the last line and again if I'm switching to the visual behavior is reflecting in the visual panel.
Removing backspace
Swithcing to Visual
So my question is after removing the backspace from text behavior is working why it's not working from the initial state and 2nd-time onwards it's working fine. No need to do the thing if I am creating the ticket for the 2nd time.
Thank You
Shubhanshu
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey! @[deleted]
Try this. I removed the enter at the beginning of """"h5.Initial situation: and end :"""".replaceAll(/ /,' ') . The images below you'll see no spaces.
Try that and see if it works for you. It worked for me.
/*
* Code to be placed as an initializer function
*/
// Get a pointer to the description field
def desc = getFieldById("description")
// Get a pointer to the issue type field and get its value
def issueType = getFieldById("issuetype")
def issueTypeVal = issueType.getValue()
// If the issue type equals issuetype ID
if (issueTypeVal == 10001) {
def defaultValue = """h5.Initial situation:
h5.Activity:
h5.Expected result / target state:
h5.Monitored result / current state:
h5.Consequence (opt.):
h5.Workaround (opt.):
h5.Used logical or physical test data (opt.):""".replaceAll(/ /,'')
if (!underlyingIssue?.description) {
desc.setFormValue(defaultValue)
}
// If any other issue type ID is returned set the description to a blank value
} else if (issueTypeVal != 10001) {
desc.setFormValue(" ")
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks for your reply.
After removing the space from the script Still, I am facing the same problem.
It's not working for the 1st time in the visual section.
Shubhanshu Trivedi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Try removing the other space. Behavoiurs are very finicky sometimes. Sorry about that.
def defaultValue ="""h5.Initial situation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thank You So Much for your help.
Now it's behaving properly, Sometimes it's not.
As you already mention that behaviors are very finicky sometimes.
Once again thank you so much.
Have a good day.
Shubhanshu trivedi
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You're very welcome!
If you could please accept this answer as a solution that would be great!
Have a good one!
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.