Skip to content

Custom fields default value on Objects from modules are not set #17820

Closed
@Etibru

Description

@Etibru

Deployment Type

Self-hosted

Triage priority

N/A

NetBox Version

v4.1.4

Python Version

3.12

Steps to Reproduce

  1. Create a required custom field and set a default value. Choose an object like DCIM > Interface.
{
    "id": 8,
    "display": "My cf",
    "object_types": [
        "dcim.interface"
    ],
    "type": {
        "value": "text",
        "label": "Text"
    },
    "related_object_type": null,
    "data_type": "string",
    "name": "My_CF",
    "label": "",
    "group_name": "",
    "description": "",
    "required": true,
    "unique": false,
    "search_weight": 1000,
    "filter_logic": {
        "value": "loose",
        "label": "Loose"
    },
    "ui_visible": {
        "value": "always",
        "label": "Always"
    },
    "ui_editable": {
        "value": "yes",
        "label": "Yes"
    },
    "is_cloneable": false,
    "default": "default_value",
    "related_object_filter": null,
    "weight": 100,
    "validation_minimum": null,
    "validation_maximum": null,
    "validation_regex": "",
    "choice_set": null,
    "comments": "",
}

2.Create a module type with a few interfaces.
17295182262847603361889833276334

  1. Create a device, create a module bay on this device.
    17295182378236963683433093075664

  2. Connect a module with the module type
    17295182497146946160325110780536

Now, we have the interfaces from the type module that have been added to the device.
17295182632186578896907287261420

And if we see an Interface:
17295182817146530767661734069473

We can see that the default value has not been set.

"custom_fields": {
"My_CF": null
},
Note that in devices with device_type, interface custom fields (for example) are set to the default value

Expected Behavior

We should have the default value and not null. on the same way as on a device type with interfaces, when the device is created, there will be the default value on the interfaces custom field.

Observed Behavior

Interfaces that are created when the module is connected to a device, the default values of custom fields are not set to their default values.

Metadata

Metadata

Assignees

Labels

netboxseverity: mediumResults in substantial degraded or broken functionality for specfic workflowsstatus: acceptedThis issue has been accepted for implementationtype: bugA confirmed report of unexpected behavior in the application

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions