Custom data default value

I have added custom fields to entries from the custom data.
The custom field is of type “text select list”.
Is there a way to configure one the the values to be selected by default?

Hi @benny_1,

The custom metadata schemas are defined as XSDs. You can see the generated XSD by going to KMC->Settings->Custom Data->Click on schema name->Download XSD Schema.
There is no way to indicate a default value from KMC, I’m afraid. If you wish to later display these options from your own front I/F, you can create your own XSD and then use that to create the custom metadata schema yourself via the API.

For instance, here is what a simple select list definition looks like:

          <xsd:simpleType>
            <xsd:restriction base="listType">
              <xsd:enumeration value="A"/>
              <xsd:enumeration value="AA"/>
              <xsd:enumeration value="AAA"/>
            </xsd:restriction>
          </xsd:simpleType>

so, say you want to mark “AA” as the default value in your UI, you can change it to:

          <xsd:simpleType>
            <xsd:restriction base="listType">
              <xsd:enumeration value="A"/>
              <xsd:enumeration value="AA" default="true"/>
              <xsd:enumeration value="AAA"/>
            </xsd:restriction>
          </xsd:simpleType>

Then create the schema using the metadataProfile service, like so:

    $metadataProfile->name = $profile_name;

    $metadataProfile->createMode = KalturaMetadataProfileCreateMode::KMC;
    $metadataProfile->systemName = $profile_name;
    $metadataProfile->objectType = 1; 
    $metadataProfile->metadataObjectType = 1; 
    //try{
        $results = $client->metadataProfile->add($metadataProfile, $xsdData, $viewsData);
    //}catch(){

    //}  

and then get the XSD using the API from your own front interface, parse it and look for the “default” attrib to determine which selectbox option to set as default in your generated HTML code.

Again, KMC will completely ignore this but if you want to create your own interface for updating the entry metadata, you can take into account the “default” attrib when parsing the schema XSD there.