Scriptrunner behaviour

Stanislav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2021

I should write in a behaviour if i want field "due date" be shown only if priority is "To time" and i done it:

import com.atlassian.jira.issue.IssueConstantImpl
def priority = getFieldById(getFieldChanged())
def selectedPriority = ((IssueConstantImpl) priority.getValue()).getName()
def SV = getFieldByName("due date")if ( selectedPriority == "To time") {
SV.setHidden(false)
} else {
SV.setHidden(true)
}


And the main question what to write to make "due date" required field and only when it shown on the create screen ?
Need help please  

2 answers

1 accepted

2 votes
Answer accepted
Dirk Ronsmans
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
May 20, 2021

Hi @Stanislav ,

You can add that to your behaviour. Just like setHidden you also have setRequired

image.png

0 votes
Ashkan Malekly
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2021

Hi @Stanislav 

Why don't you use a validator (field required) to create issue transition on workflow? I mean make the "due date" field, required to create transition on workflow?

Stanislav
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 20, 2021

@Ashkan Malekly Because it only need to be required when i choose priority "To time" and the script that i wrote show this field on the create issue screen. Else it should not be required!

Suggest an answer

Log in or Sign up to answer