Validation Rules: relations of relations?
Hey all,
I’m going a bit cross-eyed here.
I’ve got a validation rule that should verify that Acronyms on which an asset is dependent have related Business Terms.
Eg…
Policy depends on definition of Business Term (some of which are Acronyms)
Acronym is acronym for Business Term
rule {
given {
supportingAcronyms = relations.'depends on definition of'?.findAll{it.assetType.name == 'Acronym'}
supportingAcronymNames = relations.'depends on definition of'?.findAll{it.assetType.name == 'Acronym'}.name
}
then {
isEvery ( supportingAcronyms,
{ isNotEmpty (it.relations.'is acronym for') },
message: "A Business Term is not associated with one of the following: ${supportingAcronymNames}"
)
}
}
Problem is: It fails regardless whether the supporting acronym is an acronym for a business term or not.
What is the obvious silly thing that I am missing?
Tom Friesen
Posted 3 years ago · Edited 1 year ago·Last reply 3 years ago
5 comments
georgecheung
·3 years ago · Editedaccording to: https://productresources.collibra.com/docs/collibra/latest/Content/Assets/ref_asset-model.htm
Which means relations and complex relations can only be extracted from the first level, so it would not be possible to use validation rules to retrieve relations of relations. In this case - I would recommend using workflows to do the validation since the workflow does not have that 1 level relation limitation.
arthurburkhardt
·3 years ago · Edited@tom.friesen Even though the validation rules
relationsproperty are supposed to returnMap<String,List<AssetModel>>, therelationsis not populated (i.e. it is not recursive).You can quickly check with the following code (based on a Data Asset - is represented by -> Acronym -> is acronym for -> Business Term):
Funnily enough, this generates an error FROM THE POSTGRES DATABASE (because the datatype only support VARCHAR(255) and collibra tries to insert the full result message, which then gets logged. => Positive side effect, we get logging! w(゚Д゚)w
In my case, the (edited) log says:
As you can see, the “relations” field is empty, even though there is a relation from my
PIIacronym to a business term.Tom Friesen
OP3 years ago · EditedThanks for the detail, @arthur.burkhardt, as disappointing as it is. The question I’m asking myself now is: Is this by design, or is this a bug? If I find out, I’ll circle back here with an answer.
arthurburkhardt
·3 years ago · EditedIn my opinion, those are two bugs:
mickkarls
·3 years ago · Edited@tom.friesen. One of our internal experts had this to say: Validation rules are complicated, unfortunately. Checking this will take some time, it seems they are using custom relations, so in any case we cannot test it. Also it is not clear (from the message) what is the error?
I suggest 2 things: