# Block helpers in Mutate blocks

**URL:** https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573
**Category:** Help
**Tags:** workflow
**Created:** [June 6, 2022, 9:02am UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573 "2022-06-06T09:02:03Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [June 6, 2022, 9:02am UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/1 "2022-06-06T09:02:03Z")

</div>

Hi there,  
can we use block helpers inside mutate blocks?  
I am getting an invalid template error for such simple block:

 ![image](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/0/0c6800401f7e52fa99d9eba5068df86f54369629.png)

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [June 6, 2022, 11:56am UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/2 "2022-06-06T11:56:49Z")

</div>

You can use block helpers, but that format is not a valid `{{#if}}` helper. Instead, try …

```handlebars
{{#eq working.device.test null}}test is missing{{/eq}}

```

---

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [June 7, 2022, 1:37pm UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/3 "2022-06-07T13:37:38Z")

</div>

Interesting, when and where should I use the if block?  
For example I want to use that in combination with a regex condition.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [June 7, 2022, 2:18pm UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/4 "2022-06-07T14:18:04Z")

</div>

I think the [Handlebars documentation](https://handlebarsjs.com/guide/builtin-helpers.html#if) explains it best.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [June 7, 2022, 2:19pm UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/5 "2022-06-07T14:19:37Z")

</div>

As for matching on a regular expression, Losant has a custom block helper for that. From [our documentation](https://docs.losant.com/workflows/accessing-payload-data/#conditional-block-helpers):

```auto
{{#match str regExpStr}}: Returns true if str matches the regular expression regExpStr.

```

---

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [June 7, 2022, 4:29pm UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/6 "2022-06-07T16:29:35Z")

</div>

Gosh I feel dumb, apparently you can also do:

```auto
{{#if (eq person "John")}} hello {{/if}}

```

I guess #eq is the shortened version of the #if (eq ) syntax.

---

<div class="post-metadata">

### Author: ![Dylan\_Schuster](https://sea1.discourse-cdn.com/flex015/user_avatar/forums.losant.com/dylan_schuster/32/2850_2.png) [@Dylan\_Schuster](https://forums.losant.com/u/Dylan_Schuster)
#### Post date: [June 7, 2022, 5:40pm UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/7 "2022-06-07T17:40:08Z")

</div>

> [@Paolo\_Proxy](#):
>
> ```auto
> {{#if (eq person "John")}} hello {{/if}}
> 
> ```

Did you really get that to work? If so, where did you apply it? I wold not expect that syntax to work when trying to use a block helper as a subexpression.

 ![Screen Shot 2022-06-07 at 1.39.06 PM](https://us1.discourse-cdn.com/flex015/uploads/getstructure/original/2X/e/ea0db78c0567802f4064637254771ed0306a51f2.png)

---

<div class="post-metadata">

### Author: ![Paolo\_Proxy](https://avatars.discourse-cdn.com/v4/letter/p/b5ac83/32.png) [@Paolo\_Proxy](https://forums.losant.com/u/Paolo_Proxy)
#### Post date: [June 8, 2022, 9:22am UTC](https://forums.losant.com/t/block-helpers-in-mutate-blocks/4573/8 "2022-06-08T09:22:55Z")

</div>

> [@Paolo\_Proxy](#):
>
> `{{#if (eq person "John")}} hello {{/if}}`

This is a new world to me, apparently that syntax is only available with this:

> **[GitHub - jmurphyau/ember-truth-helpers: Ember HTMLBars Helpers for {{if}}...](https://github.com/jmurphyau/ember-truth-helpers)**
>
> Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq & is-array - GitHub - jmurphyau/ember-truth-helpers: Ember HTMLBars Helpers for {{if}} & {{unless}}: not, and, or, eq &a...

which I discovered to be not the vanilla Handlebar solution!  
Love the payload tester, useful!
