Skip to main content

Is anyone able to provide guidance on how to make the businessDefintion a required field when creating new terms?

 

Hi ​@sjettawi default fields are not able to be modified. If you wish to do something similar you can create another attribute similar to businessDefinition and then modify as needed.
If you would like to make a attribute mandatory, inside of the Metadata Model you can set the flag for ‘Required’ to be on.
See screenshot attached.
You can find this in Metadata Model → Term(Or any entity you want to customize) 
 

 


Hi ​@sjettawi , to add to Robert’s comment, it is possible to make the field mandatory even after it’s published in the model, however using custom Upgrade commands. You can use the following upgrade command:

{
name: "Make businessDefinition property mandatory",
description: "Sets property businessDefinition of node term as required",
operations: t
{
name: "AddConstraint",
args: {
targetNode: "term",
targetProperty: "businessDefinition",
constraint: {
id: "DEFINITION_REQUIRED",
type: "REQUIRED"
}
}
}
]
}

You will save this as a json5 file and upload it through System changes: https://docs.ataccama.com/one/latest/metadata-model/system-changes.html#add-changes.

However, this will cause that all your existing terms, that won’t have the business definition filled, will become invalid (you will see an error in each of them). So I highly recommend to populate the field everywhere before uploading this. Also, it is recommended to do a DB backup before performing such change. For that reason it is much safer to create a new field as Robert described.

You can use a similar command to remove the constraint as well:

{
name: "Remove required constraint from terms",
description: "",
operations: p
{
name: "RemoveConstraint",
args: {
targetNode: "term",
targetProperty: "businessDefinition",
"constraintId": "DEFINITION_REQUIRED"
}
}
]
}

Kind regards,

Anna


Hi ​@sjettawi, does either Anna or Robert’s solutions work for you? If yes, could you mark one as best answer please 🙏


Reply