When working with the captures() function in Cortex, you may encounter certain limitations when dealing with complex objects. This article explains these limitations and provides solutions for handling arrays effectively.
While Cortex allows you to capture entire objects, there are some important considerations to keep in mind:
You can capture a complete object using syntax like
captures('data', custom('data'))However, directly accessing nested properties within captured objects may not be straightforward
The captured object will appear in error messages, but extracting specific nested properties often requires additional processing
When you need to display items from a captured array in Cortex Scorecards without specifying a key, you can use the dot (.) notation in Mustache templates:
{{#context.evaluation.captures.deploymentWithIssues}}
* {{.}}
{{/context.evaluation.captures.deploymentWithIssues}}This approach allows you to iterate through the array and display each item individually, which is particularly useful when working with lists of values that don't have specific keys.