Switch Workflow Notification template if Digest

Scenario: We want to change the content of a Notification, if the notification contains only 1 event (to support pluralisation) Problem: The following expression is always true, even if there is only 1 event:
{{#if step.digest}}
{{uploaderName}} hat {{step.total_count}} neue Dateien in {{step.events.0.folderName}} hochgeladen.
{{else}}
{{uploaderName}} hat eine neue Datei in {{folderName}} hochgeladen.
{{/if}}
{{#if step.digest}}
{{uploaderName}} hat {{step.total_count}} neue Dateien in {{step.events.0.folderName}} hochgeladen.
{{else}}
{{uploaderName}} hat eine neue Datei in {{folderName}} hochgeladen.
{{/if}}
We tried also to change the expression to a greater then expression using the step.total_count, but this is not supported on your side. Any idea how we can implement this?
7 Replies
Gali Baum
Gali Baum2y ago
We have a handlebar helper for pluralization like this: {{pluralize dog_count "dog" "dogs"}} You could also use {{#equals step.total_count 1}} .. {{else}}..{{/equals}} @sebastiankuesters let us know if that works for you 🤩
Sebastian Küsters
This works fine, better then the if-statement 🚀 Also interesting Insight, thanks
mdd
mdd2y ago
to be honest I think any helpers and general handlebars syntax should be documented in docs
Gali Baum
Gali Baum2y ago
@unicodeveloper @sumitsaurabh927 I believe there is something in the works novu
Prosper
Prosper2y ago
Yes. @sumitsaurabh927 is starting work on that next week.
Gali Baum
Gali Baum2y ago
Perfect. Feel free to reach out if you need anything @sumitsaurabh927
sumitsaurabh927
Will do, thanks Gali
Want results from more Discord servers?
Add your server