Hello everyone,
We have recently made an update to the smart value system which enables a few new features. The change enables the conditional logic and other functions to be used inside nested smart values (such as list notation).
This enables some useful tricks, like filtering lists or applying complex functions to fields on an object.
Previously, if you had a list smart value, it was impossible to selectively display information inside the list based on some condition.
Take the example of issue comments. Imagine you would like to print out just the internal comments, and ignore the public comments.
You now can use an if statement to filter the list to only get the internal comments
{{#issue.comments}}
{{ if(isInternal, body) }}
{{/}}
This results in
This can be used to also create some much more complex messages as well:
{{#issue.comments}}
{{#if(isInternal)}}
- An internal comment by {{author.emailAddress.abbreviate(5)}}: {{body}}
{{/}}
{{/}}
There are a wide number of functions that can be used, such as:
{{#issue}} {{#=}} {{number_field}} + 10 {{/}} {{/}}
{{#lookupIssues}} Send web request with summaries {{urlencode(summary)}} {{/}}
{{#issue.comments}} Reading comment at time {{now}} {{/}}
{{#issues}}
{{#if(gt(comments.size, 10))}}
Issue {{key}} has more than 10 comments!
{{/}}
{{/}}
More information about the functions and smart value capabilities can be found in our smart value documentation. More information and examples will be posted there as we continue to develop more features in the smart value system.
Cheers!
Sam
Sam Harding
27 comments