I've got a use case where the service desk agents want to make the text field required when someone selects an Critical priority for a new ticket. They also want to add some additional description next to the text field to explain to the user why this text field is now required.
I had hoped that ScriptRunner Behaviours would do the trick, and I can make it required. BUT how do get it back to the default values once the user changes their mind and selects something besides Critical?
I need to form to default back to the original conditions, both about if the text field is required or not (it is on some forms, but not on others) and to revert back to the original description that was next to the field (it's different on different forms).
Just to clarify, "Critical" is a priority not an issue type, right?
If a user selects "Critical" priority, you want the description required and set a help text for it. But if he changes to a different priority you want to revert back to whatever config description had initially (which was dependent on the issue type).
BTW sorry for all the questions. Im just trying to get a full understanding before I give you an answer :)
Yes, sorry, "Critical" is a priority, not an issue type. Bad copy/paste on my part. I'll update my previous comment to make it clearer.
And yes, the way you summed it up is correct.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Unfortunately, I cannot see an easy way of doing this. The best way, though tedious, is going through all the request types and seeing which ones have description required. Then after changing your if statement:
if (priority == "Critical") {
# set description required
} else if (issuetype in [issue types that have description required]) {
# set description required
} else {
# set description optional
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yeah, I was afraid of that. I was hoping I was missing something obvious.
Thanks for looking into this for me.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You could have your behaviour script assigned to the Issue Type field. That way whenever the issue type changes, depending on what it changed to, you would perform some operations.
def issueType = issueContext.issueType.name
if (issueType == "Critical") {
// set field required
// set description text
} else {
// set field optional
// clear description text
}
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
This I could do. But I need something a little bit more. In some of the request types, the field is not optional. I need the code to revert back to the original configuration, which varies by request type. That's the part I'm stuck on.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Could you please provide me with more details and then I can write a script for you? The more details and more mechanical you can be the better the script I can give you.
Things like what you want done for each request types, what you want done when switching between request types, etc.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
We have about 30 different request types. For some of them, by default, the description field is optional and for some it is required. For some of them, by default has Field Help text for the descriptions, other's do not.
The Field Help part I'm less worried about. I think I can do a concatenation of the extra instructions before the Field Help text and then do a .replaceAll to remove the extra instructions when Critical is not selected.
It's reverting back to the original preferences on if the description field is optional or not that's throwing me.
Ideally, it would look something like this
if (issue Priority == "Critical") {
// set description field to required
// add strExtraText to the description Help Field text
} else {
// set description field back to original config (either required or not) -> this is the hard part I'm having trouble with
// remove strExtraText from the description Help Field text to revert back to original Help Field text
}
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.