Examples to use Variables for the HTML Requests or Email Templates

To access the entity attributes

CODE
${latestEvent.modernEntity.attributes}


${latestEvent.modernEntity.attributes.get("k8s.cluster.name")}

To print modern entity and legacy entity from affected entity

JSON
#foreach($entity in $latestEvent.affectedEntities)
  #if($entity.isLegacyEntity)
    * Legacy Entity: 
	    Affected Entity Name: ${entity.name}
		Affected Entity Type: ${entity.entityType}
		Affected Entity Tags: ${entity.tagValues}
  #else
    * Modern Entity: 
		Affected Entity Name: ${entity.name} 
        Affected Entity Type Display Name: ${entity.entityTypeDisplayName} 
		Affected Entity Attributes: ${entity.attributes}
  #end
#end

To print the cluster, namespace for Pod

JSON
#foreach($entity in $latestEvent.affectedEntities)
  #if($entity.attributes)
    #set($attrs = $entity.attributes)
    #if($attrs.get("k8s.cluster.name"))
      - Cluster: ${attrs.get("k8s.cluster.name")}
    #if($attrs.get("k8s.namespace.name"))
      - Namespace: ${attrs.get("k8s.namespace.name")}
    #end
  #end
#end