Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Using Behaviours plugin can we make Attachment field mandatory on Issue Creation

Madhusudhan Matrubai
Contributor
March 7, 2018

Hi There,

I have a need to make the Attachment mandatory depending on the field selection during issue creation. I have got the following but that's not working, is this supposed to work even against system field like - Attachments?

Mapped to field > "is pres prepared"

def presentationPrepared = getFieldById(getFieldChanged())
def presentationAttachment = getFieldByName("Attachments")

def selectedOptionPresPrep = presentationPrepared.getValue() as String
def isPresentationPrepSelected = selectedOptionPresPrep == "Yes"
def isPresentationPrepNotSelected = selectedOptionPresPrep == "No"

presentationAttachment.setRequired(isPresentationPrepSelected)

 

1 answer

1 accepted

4 votes
Answer accepted
Jenna Davis
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.
March 7, 2018

Hello, 

Unfortunately, you cannot do this using a behaviour. See this bug report for more information.

Instead, you can set up a custom script validator to handle this. There is an example on how to do so in the comments on that report. :) 

Please let me know if you have any further questions.

Jenna

Madhusudhan Matrubai
Contributor
March 7, 2018

Thanks Jenna for confirming this.

Like Yana Stoliarova likes this

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events