You're on your way to the next level! Join the Kudos program to earn points and save your progress.
Level 1: Seed
25 / 150 points
Next: Root
1 badge earned
Challenges come and go, but your rewards stay with you. Do more to earn more!
What goes around comes around! Share the love by gifting kudos to your peers.
Keep earning points to reach the top of the leaderboard. It resets every quarter so you always have a chance!
Join now to unlock these features and more
The Atlassian Community can help you and your team get more value out of Atlassian products and practices.
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.