Skip to content

action_create_cust_attrs

This action creates/updates custom attributes.

First part take care about special attributes

- AYON attributes defined in code because they use constants

Second part is based on json file in ftrack module.

File location: ./common/custom_attributes.json

Data in json file is nested dictionary. Keys in first dictionary level represents ftrack entity type (task, show, assetversion, user, list, asset) and dictionary value define attribute.

There is special key for hierchical attributes is_hierarchical.

Entity types task requires to define task object type (Folder, Shot, Sequence, Task, Library, Milestone, Episode, Asset Build, etc.) at second dictionary level, task's attributes are nested more.

*** Not Changeable *********

group (string) - name of group - based on attribute common.constants.CUST_ATTR_GROUP - "pype" by default

*** Required *********

label (string) - label that will show in ftrack

key (string) - must contain only chars [a-z0-9_]

type (string) - type of custom attribute - possibilities: text, boolean, date, enumerator, dynamic enumerator, number

*** Required with conditions *******

config (dictionary) - for each attribute type different requirements and possibilities: - enumerator: multiSelect = True/False(default: False) data = {key_1:value_1,key_2:value_2,..,key_n:value_n} - 'data' is Required value with enumerator - 'key' must contain only chars [a-z0-9_]

    - number:
        isdecimal = True/False(default: False)

    - text:
        markdown = True/False(default: False)

*** Presetable keys **********

write_security_roles/read_security_roles (array of strings) - default: ["ALL"] - strings should be role names (e.g.: ["API", "Administrator"]) - if set to ["ALL"] - all roles will be availabled - if first is 'except' - roles will be set to all except roles in array - Warning: Be carefull with except - roles can be different by company - example: write_security_roles = ["except", "User"] read_security_roles = ["ALL"] # (User is can only read)

default - default: None - sets default value for custom attribute: - text -> string - number -> integer - enumerator -> array with string of key/s - boolean -> bool true/false - date -> string in format: 'YYYY.MM.DD' or 'YYYY.MM.DD HH:mm:ss' - example: "2018.12.24" / "2018.1.1 6:0:0" - dynamic enumerator -> DON'T HAVE DEFAULT VALUE!!!

Example:

"show": {
    "ayon_auto_sync": {
      "label": "AYON auto-sync",
      "type": "boolean",
      "write_security_roles": ["API", "Administrator"],
      "read_security_roles": ["API", "Administrator"]
    }
},
"is_hierarchical": {
    "fps": {
        "label": "FPS",
        "type": "number",
        "config": {"isdecimal": true}
    }
},
"task": {
    "library": {
        "my_attr_name": {
            "label": "My Attr",
            "type": "number"
        }
    }
}