Forums

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

How to make custom field as mandatory. by using groovy script?

Rudraiah B
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
June 19, 2023

I want to make custom field as mandatory by using groovy script code.Please help me on that. Intitially  dont have code how to write.

1 answer

0 votes
Evgenii
Community Champion
June 19, 2023

Hi, @Rudraiah B 

If I understood you right, you are using ScriptRunner with groovy scripts.

In ScriptRunner it can be made with Behaviours. You have to add new Behaviour, map it to Project and Issue type.

Then add initializer script, like:

import com.onresolve.jira.groovy.user.FieldBehaviours
import com.onresolve.jira.groovy.user.FormField
import groovy.transform.BaseScript

@BaseScript FieldBehaviours fieldBehaviours

FormField requiredField = getFieldById("customfield_12345")

requiredField.setRequired(true)

 

Suggest an answer

Log in or Sign up to answer
DEPLOYMENT TYPE
SERVER
VERSION
1.1
TAGS
AUG Leaders

Atlassian Community Events