The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

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

Hi, Our team is trying to build a custom plugin for Jira Datacenter to make custom fields mandatory.

Preethihr
September 29, 2021

Can anyone help me to find any classes or methods in java to update field configuration by setting custom field as required.

I have found following method but I am not able to implement updateFieldLayoutItem method.

public void makeRequired(FieldLayoutItem fieldLayoutItem){  if (!getFieldManager().isRequirableField(fieldLayoutItem.getOrderableField()))  {    throw new IllegalArgumentException("Trying to require a field that is not requireable.");  }  // When requiring a field make it not hidden  final FieldLayoutItem modified = new FieldLayoutItemImpl.Builder(fieldLayoutItem)      .setHidden(false)      .setRequired(true)      .build();  updateFieldLayoutItem(fieldLayoutItem, modified);}

 

1 comment

Comments for this post are closed

Community moderators have prevented the ability to post new comments.

Daniel Ebers
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 Champions.
July 31, 2022

A good point to start could be the documentation for Jira Sever (aimed to developers) which you can find here: https://docs.atlassian.com/software/jira/docs/api/8.22.6/
Please also find the start page which could be of further help:
https://developer.atlassian.com/server/

Please note that there are finally some Apps which probably cater the need. So it might make sense to have a look into Atlassian Marketplace in case you do not want to create the code from scratch by yourself.

TAGS
AUG Leaders

Atlassian Community Events