Email template - testing for package id

Hopefully a simple question. We have a number of actions in our process and some of them will be skipped according to channel. In our email template we have something like this:

#{each action in Octopus.Action}
	<tr>
		<td>#{action.Name}</td>
		<td>#{if action.Package.NuGetPackageId}#{action.Package.NuGetPackageVersion}#{/if}</td>
		<td>#{if action.TargetRoles}#{action.TargetRoles}#{/if}</td>
	</tr>
#{/each}

The output is perfect when the action has a package that has been deployed, but for the skipped actions, if is displaying the raw text #{action.Package.NuGetPackageVersion} rather than an empty cell.

Should I be trying something like this: #{if action.Package} or something else?

And on closer examination I’m testing for NuGetPackageId and displaying NuGetPackageVersion which is clearly … stupid.

Hi Robert,

Thanks for reaching out! You should be looing at #{action.IsSkipped}, like this example:

#{each action in Octopus.Action}
    	<p>-------------------------------</p>
		#{if action.IsSkipped != "True"}
        <p>#{action.Name}</p>        
        <p>#{if action.Package.NuGetPackageId}#{action.Package.NuGetPackageVersion}#{/if}</p>
        <p>#{if action.TargetRoles}#{action.TargetRoles}#{/if}</p>
        #{/if}
        #{if action.IsSkipped == "True"}
        <p>#{action.Name} - This step was skipped</p>
        #{/if}
        <p>-------------------------------</p>    
#{/each}

Hope that helps!
Dalmiro