Making Jira custom field required by using java atlassian sdk

Hello Atlassian Community,

I’m developing a plugin for Jira Data Center using the Atlassian SDK and Java. I need to create a custom field and ensure it’s marked as required during issue creation. While I can create the custom field using the CustomFieldManager, I haven’t found a method to set it as required programmatically.

Could someone guide me on how to enforce a custom field as required through code? Is there an API or approach to achieve this, or is it only possible via field configurations in the UI? I want to do it by java code itself, and not by running any scripts.

Any insights or examples would be greatly appreciated!

Use the field configuration to make your field required. The field should most likely not be required in all projects and issue types and therefore you shouldn’t try to enforce this in the Java code of the custom field.