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
CustomFieldApiMethod
CustomFieldAPI
Bases: BaseAlbertModel
Configuration for API-backed custom fields.
Show JSON schema:
{
"$defs": {
"CustomFieldApiMethod": {
"description": "HTTP methods supported by API-driven custom fields.",
"enum": [
"GET"
],
"title": "CustomFieldApiMethod",
"type": "string"
}
},
"description": "Configuration for API-backed custom fields.",
"properties": {
"endpoint": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Endpoint"
},
"method": {
"anyOf": [
{
"$ref": "#/$defs/CustomFieldApiMethod"
},
{
"type": "null"
}
],
"default": null
},
"queryParamsField": {
"anyOf": [
{
"items": {
"type": "string"
},
"type": "array"
},
{
"type": "null"
}
],
"default": null,
"title": "Queryparamsfield"
}
},
"title": "CustomFieldAPI",
"type": "object"
}
Fields:
-
endpoint(str | None) -
method(CustomFieldApiMethod | None) -
query_params_field(list[str] | None)
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 | float | None
|
The minimum value of the custom field, optional. Defaults to None. |
max |
int | float | 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 |
custom_entity_categories |
list[str] | None
|
Custom entity categories that define where the field is valid. |
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. |
editable |
bool | None
|
Decides whether the field should be editable on UI or not. |
api |
CustomFieldAPI | None
|
API configuration for fields backed by remote data sources. |
Methods:
| Name | Description |
|---|---|
confirm_field_compatability |
|
ensure_default_has_type |
|
entity_categories
entity_categories: list[EntityCategory] | None = Field(
default=None, alias="entityCategory"
)
custom_entity_categories
ui_components
ui_components: list[UIComponent] | None = Field(
default=None, alias="ui_components"
)
confirm_field_compatability
confirm_field_compatability() -> CustomField
ensure_default_has_type
Source code in src/albert/resources/custom_fields.py
SearchableCustomField
Bases: BaseAlbertModel
Metadata describing custom fields exposed to search.
Show JSON schema:
{
"description": "Metadata describing custom fields exposed to search.",
"properties": {
"label": {
"title": "Label",
"type": "string"
},
"type": {
"title": "Type",
"type": "string"
},
"isSortable": {
"anyOf": [
{
"type": "boolean"
},
{
"type": "null"
}
],
"default": null,
"title": "Issortable"
},
"sortByParam": {
"anyOf": [
{
"type": "string"
},
{
"type": "null"
}
],
"default": null,
"title": "Sortbyparam"
},
"isCustom": {
"title": "Iscustom",
"type": "boolean"
}
},
"required": [
"label",
"type",
"isCustom"
],
"title": "SearchableCustomField",
"type": "object"
}
Fields:
-
label(str) -
type(str) -
is_sortable(bool | None) -
sort_by_param(str | None) -
is_custom(bool)