Interface CustomFields

All Known Implementing Classes:
CustomFieldsImpl

public interface CustomFields
Actions for administering the custom fields in JIRA.
Since:
v4.0
  • Method Details

    • addCustomField

      String addCustomField(String fieldType, String fieldName)
      Adds a custom field of the specified type to JIRA.

      The default searcher is used, and the custom field is added to the global project/issue type context.

      The field is added to the Default Screen.

      Parameters:
      fieldType - the full name of the custom field type to add e.g. com.atlassian.jira.plugin.system.customfieldtypes:userpicker
      fieldName - the name of the custom field e.g. UserCF
      Returns:

      A formatted String containing the id of the custom field, the format used is: customfield_customfield-id

      For example, customfield_10000

    • addCustomField

      String addCustomField(String fieldType, String fieldName, String[] issueTypeIds, String[] projectIds)
      Adds a custom field of the specified type to JIRA.

      The default searcher is used. The context is created for the specified issue types and projects.

      The field is added to the Default Screen.

      Parameters:
      fieldType - the full name of the custom field type to add e.g. com.atlassian.jira.plugin.system.customfieldtypes:userpicker
      fieldName - the name of the custom field e.g. UserCF
      issueTypeIds - the ids of the issue types; must not be null
      projectIds - the ids of the projects; must not be null
      Returns:
      the custom field id e.g. customfield_10000
    • setCustomFieldSearcher

      String setCustomFieldSearcher(String numericCustomFieldId, String searcherKey)
      Sets the searcher for the specified custom field. Use the return value to reset the searcher to its previous value later.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      searcherKey - the full key of the searcher to use e.g. com.atlassian.jira.plugin.system.customfieldtypes:numberrange. Use null to remove the searcher.
      Returns:
      the previously used searcher key
    • renameCustomField

      String renameCustomField(String numericCustomFieldId, String newCustomFieldName)
      Renames the custom field.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      newCustomFieldName - the new name for the custom field e.g. My CF
      Returns:
      the previously used name
    • addConfigurationSchemeContext

      String addConfigurationSchemeContext(String numericCustomFieldId, String label, String[] issueTypeIds, String[] projectIds)
      Adds a custom field configuration scheme context.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      label - the new name
      issueTypeIds - the ids of the issue types; must not be null
      projectIds - the ids of the projects; must not be null
      Returns:
      the numeric id of the field config scheme created e.g. 10013
    • addConfigurationSchemeContext

      String addConfigurationSchemeContext(FieldId fieldId, String label, String[] issueTypeIds, String[] projectIds)
      Adds a custom field configuration scheme context.
      Parameters:
      fieldId - field id
      label - the new name
      issueTypeIds - the ids of the issue types; must not be null
      projectIds - the ids of the projects; must not be null
      Returns:
      the numeric id of the field config scheme created e.g. 10013
    • editConfigurationSchemeContextById

      void editConfigurationSchemeContextById(String numericCustomFieldId, String fieldConfigSchemeId, String label, String[] issueTypeIds, String[] projectIds)
      Alters an existing custom field configuration scheme context.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      fieldConfigSchemeId - the id of the scheme
      label - the new name; use null if no update required
      issueTypeIds - the ids of the issue types; use null if no update required
      projectIds - the ids of the projects; use null if no update required
    • editConfigurationSchemeContextByLabel

      void editConfigurationSchemeContextByLabel(String numericCustomFieldId, String label, String newLabel, String[] issueTypeIds, String[] projectIds)
      Alters an existing custom field configuration scheme context.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      label - the label of the scheme
      newLabel - the new name; use null if no update required
      issueTypeIds - the ids of the issue types; use null if no update required
      projectIds - the ids of the projects; use null if no update required
    • removeGlobalContext

      void removeGlobalContext(String numericCustomFieldId)
      Removes the global context from the specified custom field's configuration schemes.
      Parameters:
      numericCustomFieldId - the numeric custom field id
    • removeConfigurationSchemeContextById

      void removeConfigurationSchemeContextById(String numericCustomFieldId, String fieldConfigSchemeId)
      Removes the context from the specified custom field with the specified config scheme id.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      fieldConfigSchemeId - the numeric field config scheme id
    • removeConfigurationSchemeContextByLabel

      void removeConfigurationSchemeContextByLabel(String numericCustomFieldId, String fieldConfigSchemeLabel)
      Removes the context from the specified custom field with the specified config scheme id.
      Parameters:
      numericCustomFieldId - the numeric custom field id
      fieldConfigSchemeLabel - the label of the field config scheme
    • removeCustomField

      void removeCustomField(String customFieldId)
      Removes the custom field
      Parameters:
      customFieldId - the full custom field id e.g. customfield_10000
    • addOptions

      void addOptions(String numericCustomFieldId, String... options)
      Add options to a customfield that supports it (i.e. selectlist)
      Parameters:
      numericCustomFieldId - the numeric customfield id
      options - the options to add
    • setDefaultValue

      void setDefaultValue(String numericCustomFieldId, String defValue)
      Deprecated.
      Set default value for any custom field that supports default value.
      Parameters:
      numericCustomFieldId - the numeric customfield id
      defValue - default value
    • setDefaultValue

      void setDefaultValue(FieldId fieldId, String defValue)
      Set default value for any custom field that supports default value.
      Parameters:
      fieldId - field id
      defValue - default value
    • setCascadingSelectDefaultValue

      void setCascadingSelectDefaultValue(String numericCustomFieldId, String defValue, String cascadingDefValue)
      Set default value for any custom field that supports default value.
      Parameters:
      numericCustomFieldId - the numeric customfield id
      defValue - display text of default value
      cascadingDefValue - display text of default cascading value
    • disableOptions

      void disableOptions(String numericCustomFieldId, String... options)
      disable options from a customfield that supports them (i.e. selectlist)
      Parameters:
      numericCustomFieldId - the numeric custom field id
      options - to disable
    • enableOptions

      void enableOptions(String numericCustomFieldId, String... options)
      enable options from a customfield that supports them (i.e. selectlist)
      Parameters:
      numericCustomFieldId - the numeric custom field id
      options - to enable
    • removeOptions

      void removeOptions(String numericCustomFieldId, String... options)
      Remove options from a customfield that supports them (i.e. selectlist)
      Parameters:
      numericCustomFieldId - the numeric custom field id
      options - to remove
    • editOptionValue

      void editOptionValue(String numericCustomFieldId, String option, String newValue)
      Change teh display value of an option from a customfield that supports them (i.e. selectlist)
      Parameters:
      numericCustomFieldId - the numeric custom field id
      option - id to change
    • goToCustomFieldConfiguration

      void goToCustomFieldConfiguration(String numericCustomFieldId)
      Navigates to `Configure Custom Field` page.
      Parameters:
      numericCustomFieldId - the numeric custom field id
    • goToCustomFieldConfiguration

      void goToCustomFieldConfiguration(FieldId fieldId)
      Navigates to `Configure Custom Field` page.
      Parameters:
      fieldId - field id
    • builtInCustomFieldKey

      static String builtInCustomFieldKey(String type)
      Turns a simple key into a complete key for a built in custom field type
      Parameters:
      type - simple key
      Returns:
      complete key for the given built-in custom field type
    • funcTestCustomFieldKey

      static String funcTestCustomFieldKey(String type)
    • numericCfId

      static String numericCfId(String id)
      Turns a full customfield id into a numeric id (strips the customfield_ part).
      Parameters:
      id - full customfield id.
      Returns:
      numeric part of the customfield id.