You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.
Join groupJoin the community to find out what other Atlassian users are discussing, debating and creating.
Hi There,
Here is the behavior script I'm creating
script would look like this for now:
def sourcefield = getFieldById("duedate") def targetField = getFieldByName("XYZ") targetField.setRequired(false) if (sourcefield.getValue()){ targetField.setRequired(true) } else { targetField.setRequired(false) }
The field "Due Date" is a system field and there was a bug (SRJIRA-2758) where you can't get a system field form field by its name. You have to get by its ID instead:
def sourcefield = getFieldById("duedate")
However, it was fixed in ScriptRunner 6.19.0. I highly recommend for you to upgrade as there are a quite number of bugs that have been fixed from 6.12.0.
Regards, Eswar
Hi @Eswar Reddy
Your code seems like "if Due Date field has no value, then XYZ will be required"
Did you try changing as below
targetField.setRequired(false)
if (sourcefield.getValue()){
targetField.setRequired(true)
}
Hi @Tuncay Senturk _Snapbytes_
Appreciate your quick response.
Sorry just tried, didn't work.
I just need to check if date field contains a value?
Please advise.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Calling all Confluence Cloud Admins! We created a new Community Group to support your unique needs as Confluence admins. This is a group where you can ask questions, access resou...
Connect with like-minded Atlassian users at free events near you!
Find an eventConnect with like-minded Atlassian users at free events near you!
Unfortunately there are no Community Events near you at the moment.
Host an eventYou're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.