Custom Fields
albert.resources.custom_fields
Attributes:
Name | Type | Description |
---|---|---|
Default |
|
Default
Default = Annotated[
StringDefault | NumberDefault | ListDefault,
Field(discriminator="type"),
]
FieldType
ServiceType
The service type the custom field is associated with
Attributes:
Name | Type | Description |
---|---|---|
INVENTORIES |
|
|
LOTS |
|
|
PROJECTS |
|
|
TASKS |
|
|
USERS |
|
|
PARAMETERS |
|
|
DATA_COLUMNS |
|
|
DATA_TEMPLATES |
|
|
PARAMETER_GROUPS |
|
|
CAS |
|
FieldCategory
EntityCategory
The entity category of the custom field. Only some categories are allowed for certain services
Attributes:
Name | Type | Description |
---|---|---|
FORMULAS |
|
|
RAW_MATERIALS |
|
|
CONSUMABLES |
|
|
EQUIPMENT |
|
|
PROPERTY |
|
|
BATCH |
|
|
GENERAL |
|
UIComponent
ListDefaultValue
Bases: BaseAlbertModel
Show JSON schema:
Fields:
StringDefault
Bases: BaseAlbertModel
Show JSON schema:
Fields:
NumberDefault
Bases: BaseAlbertModel
Show JSON schema:
Fields:
ListDefault
Bases: BaseAlbertModel
Note
For multi-select custom fields, value
must be list[ListDefaultValue]
.
Show JSON schema:
{
"$defs": {
"ListDefaultValue": {
"properties": {
"albertId": {
"title": "Albertid",
"type": "string"
},
"name": {
"title": "Name",
"type": "string"
}
},
"required": [
"albertId",
"name"
],
"title": "ListDefaultValue",
"type": "object"
}
},
"description": "!!! note\n For multi-select custom fields, `value` must be `list[ListDefaultValue]`.",
"properties": {
"type": {
"const": "list",
"default": "list",
"title": "Type",
"type": "string"
},
"value": {
"anyOf": [
{
"$ref": "#/$defs/ListDefaultValue"
},
{
"items": {
"$ref": "#/$defs/ListDefaultValue"
},
"type": "array"
}
],
"title": "Value"
}
},
"required": [
"value"
],
"title": "ListDefault",
"type": "object"
}
Fields:
-
type
(Literal[LIST]
) -
value
(ListDefaultValue | list[ListDefaultValue]
)
CustomField
Bases: BaseResource
A custom field for an entity in Albert.
Returns:
Type | Description |
---|---|
CustomField
|
A CustomField that can be used to attach Metadata to an entity in Albert. |
Attributes:
Name | Type | Description |
---|---|---|
name |
str
|
The name of the custom field. Cannot contain spaces. |
id |
str | None
|
The Albert ID of the custom field. |
field_type |
FieldType
|
The type of the custom field. Allowed values are |
display_name |
str
|
The display name of the custom field. Can contain spaces. |
searchable |
bool | None
|
Whether the custom field is searchable, optional. Defaults to False. |
service |
ServiceType
|
The service type the custom field is associated with. |
hidden |
bool | None
|
Whether the custom field is hidden, optional. Defaults to False. |
lookup_column |
bool | None
|
Whether the custom field is a lookup column, optional. Defaults to False. Only allowed for inventories. |
lookup_row |
bool | None
|
Whether the custom field is a lookup row, optional. Defaults to False. Only allowed for formulas in inventories. |
category |
FieldCategory | None
|
The category of the custom field, optional. Defaults to None. Required for list fields. Allowed values are |
min |
int | None
|
The minimum value of the custom field, optional. Defaults to None. |
max |
int | None
|
The maximum value of the custom field, optional. Defaults to None. |
entity_categories |
list[EntityCategory] | None
|
The entity categories of the custom field, optional. Defaults to None. Required for lookup row fields. Allowed values are |
ui_components |
list[UIComponent] | None
|
The UI components available to the custom field, optional. Defaults to None. Allowed values are |
default |
Default | None
|
The default value of the custom field, optional. Defaults to None. |
Methods:
Name | Description |
---|---|
confirm_field_compatability |
|
ensure_default_has_type |
|
entity_categories
entity_categories: list[EntityCategory] | None = Field(
default=None, alias="entityCategory"
)
ui_components
ui_components: list[UIComponent] | None = Field(
default=None, alias="ui_components"
)
confirm_field_compatability
confirm_field_compatability() -> CustomField