Hello everyone
I have a custom field and set it to required via field configuration for this specific issue type.
The only time it should be optional is when the issue is being created since the value cannot be set at this time.
At the moment, I have the following initialiser in my behaviour.
//Set Summary
String year = new Date().format('yyyy')
def Summary = getFieldById("summary")
if(Summary.getValue() == null)
{
Summary.setFormValue("Zinsnachzahlung " + year)
}
//Make PK-Support optional on create issue screen
if (getActionName() in ["Create Issue", "Create"])
{
def PKS = getFieldById("customfield_11904")
PKS.setRequired(false)
PKS.setReadOnly(true)
}
What this looks like.
After clicking on create however.
Any idea on how else I could achieve this?
Thanks and best regards
Marius
How about changing the custom field to optional in the field configuration for the project and keeping the code you have for the behaviour and adding a else:
//Make PK-Support optional on create issue screen
if (getActionName() in ["Create Issue", "Create"])
{
def PKS = getFieldById("customfield_11904")
PKS.setRequired(false)
PKS.setReadOnly(true)
}else{
// will go here on any other screen that is not an edit screen (including when they edit a ticket)
PKS.setReadOnly(false)
PKS.setRequired(true)
}
Clever solution! That works for me!
Thanks a lot.
(I think I'll open up a bug report for this though as this should be able to work like in my example I think)
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.