Validation always says "false"
I wrote the following validation to ensure the characteristic “Description” has the phrase “created by”. However, it alway returns “False” - even if it should return “true”. HELP!!
rule {
given {
description = attributes.‘description’ }
then {
isTrue(contains (description, ‘created by’))
}
}
S Benson
Posted 3 years ago · Edited 1 year ago·Last reply 3 years ago
5 comments
Tom Friesen
·3 years ago · EditedHey Scott,
I think attributes.‘description’ will give you a collection, won’t it?
Making an assumption that you only want to check the first description attribute, you would want to do something like
description = attributes.'description'?.first()S Benson
OP3 years ago · Edited@tom.friesen,
That solved the problem. And I needed to change it to “isFalse”
Scott
S Benson
OP3 years ago · EditedUmit,
Thanks for the idea, but it still returns false all of the time.
Scott
Former User
·3 years ago · EditedOh!! That is really strange. I checked at my env and replicated the same and I am getting proper results. true when ‘created by’ in there in the description otherwise false
Former User
·3 years ago · EditedYou are missing the ‘then’ clause. Please Try
rule {
given {
description = attributes.‘description’ }
when {
contains(description,‘created by’)
}
then
{isTrue(contains(description,‘created by’))
}
}
You can always refer :: https://productresources.collibra.com/docs/collibra/2022.03/Content/DGCSettings/OperatingModel/ValidationRules/ref_advanced-validation-scripts.htm