B

3 Messages

 • 

360 Points

Monday, July 22nd, 2024 3:34 PM

Validating nested attribute within a relation

Hey there, I'm having trouble with a validation rule. I'm trying to access a nested attribute within a relation and validate its value, but I can't seem to get it right.

I've tried a few different ways to access the nested attribute, but I'm struggling to navigate the structure and perform the validation within the given context.

Any help on how to correctly access the nested attribute and perform the validation would be awesome. Thanks in advance for any tips or suggestions!

rule {
  given {
    relation = relations.'is linked to Application'?.first()
    appltype = relation.attributes.'Application Type'?.first().toString()
  }
  when{
    isNotEmpty (relation) && isFalse (appltype)}
  then{
    isNotEmpty (relation, message: "The Asset ${name} in domain ${vocabulary.name} must be linked to Application")
  }
}

668 Messages

 • 

11.9K Points

1 month ago

Hi @BUAmina

While we wait for someone with specific experience in this area to respond, we invite you to browse a few resources that might help:

Loading...