-
Notifications
You must be signed in to change notification settings - Fork 187
Closed
Description
- I have checked that the [SDK documentation][sdk-docs] and [API documentation][api-docs] doesn't solve my issue
Description of the Issue
When getting a Dropdown field's options for a given metadata template, the option only returns the value for the enum and not the ID for the enum. The ID is needed for use cases such as assigning metadata templates with a MetadataFieldFilter to a BoxRetentionPolicy.
Versions Used
Java SDK: 2.23.2
Java: 9.0.1
Steps to Reproduce
- Create a Metadata Template.
- Create a Dropdown field with multiple option
Code Snippet
MetadataTemplate accountMetadataTemplate = MetadataTemplate.getMetadataTemplate(api, ACCOUNT_METADATA_TEMPLATE_KEY);
accountMetadataTemplate.getFields().forEach(field -> {
System.out.println("Found field display name: "
+ field.getDisplayName()
+ " and key: "
+ field.getKey() + " id: "
+ field.getID());
if(field.getKey().equalsIgnoreCase(ACCOUNT_STATUS_FIELD_KEY)) {
accountStatusFieldId.set(field.getID());
field.getOptions().forEach(option -> {
System.out.println("Found field option: " + option);
});
}
});
JSON Response from pure REST
// curl https://api.box.com/2.0/metadata_templates/enterprise/account/schema -H "Authorization: Bearer ACCESS_TOKEN"
{
"id": "66e2eca3-5a60-4e00-b7d5-4133fbfe5b2c",
"type": "enum",
"key": "accountStatus",
"displayName": "Account Is Active",
"hidden": false,
"options": [
{
"id": "52f064a8-4590-465e-9291-75d6c18dd9b9",
"key": "true"
},
{
"id": "831ddfb7-552f-4aa5-88d4-4590fc70ff2b",
"key": "false"
}
]
}
Link to MetadataTemplate.Field inner Class
Link to MetadataTemplate.Field.getOptions() inner Class method
MetadataTemplate.Field.getOptions()
Link to MetadataTemplate.Field.parseJSONMember() inner Class method
Metadata
Metadata
Assignees
Labels
No labels