Skip to content

Conditional syntax for custom fields #970

Answered by rfennell
lucasssfigueredo asked this question in Q&A
Discussion options

You must be logged in to vote

I don't think there is an out the box string comparator in Handlebars see this post

So, off the top of my head, you can use something like the following using one of the handlebar helpers

{{#forEach this.workItems}}
{{#if isFirst}}### Only show this line on the first time around the loop - a title{{/if}}
{{#if (contains (lookup this.fields ''Custom.AddtoReleaseNotes'') 'true')}}
##{{this.id}} {{lookup this.fields 'System.Title'}}
Type: {{lookup this.fields 'System.WorkItemType'}}
{{{lookup this.fields 'Custom.AddtoReleaseNotes'}}}
{{{lookup this.fields 'Custom.Releasenotes'}}}
{{/if}}
{{/forEach}}

This is based on a past issue #710 and I know it works (though that was comparing tag field…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@lucasssfigueredo
Comment options

Answer selected by lucasssfigueredo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants