How to reference current workflow State in a markdown template?

“Failed to execute Action: Cannot read property ‘Name’ of undefined”

Entity.State is apparently null:

{! State:Name !}
<%= Entity.State.Name %>

You can use

{{ State.Name }}
{{State.Name}}

(period is used to get a property of a to-one related entity, colon is used to get properties of to-many related entities)

@Chr1sG - neither of those methods work. That’s why I’m asking.


Sorry. There were unnecessary spaces.
Try
{{State.Name}}

Thanks - {{State.Name}} indeed does work with the spaces removed.

This, however, still generates the error noted above:

{! State:Name !}
<%= Entity.State.Name %>

Yes, sorry for the confusion. This syntax is appropriate when you want to declare a collection with specific property(ies) so that it can then be used in Javascript.
e.g.

{! Collection:Name !}
<%= Entity.Collection.map((item) => item.Name).join(` | `) %>
1 Like