Edit EnumBundle based on Enum CustomField name

Hi,

I need to alter values of global EnumBundle based on Enum field name.

Knowing the name of the CustomField I can:

1. list all CustomFields /api/admin/customFieldSettings/customFields?fields=id,name

2. iterate them to find id corresponding to specific name

3. get properties of this CustomField /api/admin/customFieldSettings/customFields/{fieldID}

4. get or update specific EnumBundle /api/admin/customFieldSettings/bundles/enum/{bundleID}

But I cannot determine which bundleID is used in specific fieldID that I want to alter. Is it possible?

0
2 comments
Official comment

Hi Adam Frankowski. The CustomField entity has the fieldDefaults attribute. In case of an enum field, it will have the EnumBundleCustomFieldDefaults type. In this object, you can request its bundle attribute to get the ID of the default bundle in the field. 

curl --location 'https://your.youtrack.cloud/api/admin/customFieldSettings/customFields/96-99?fields=id%2Cname%2CfieldDefaults(bundle(id))' \
--header 'Authorization: Bearer <your-token>'

In the example above, 96-99 is the custom field ID, and requesting fieldDefaults(bundle(id)) should provide the expected result.

YES, that's exaclty what I was looking for, thank you!

0

Please sign in to leave a comment.