Using \ in Macros | Community
Skip to main content

Using \ in Macros

  • May 22, 2025
  • 2 replies
  • 0 views

I have done some searching and not seeming to find what I am looking for.

 

I want to use \ in a macro to display a domain login like DOMAIN.LOCAL\Firstname.Lastname

I tried DOMAIN.LOCAL\{{ticket.requester.first_name}}.{{ticket.requester.last_name}} 

In the ticket this displays as DOMAIN.LOCAL\{{ticket.requester.first_name}}.Lastname

 

If I put a space after the \ it displays properly, but I have a space in there and that will cause confusion. Can this be done?

2 replies

Francis14
  • May 23, 2025
Hello Bryan,
 
Please note that when using macros in Zendesk, the backslash (\) can be interpreted as an escape character depending on the context, which might cause issues when used directly before liquid placeholders like Bryan.
 
You can use </> instead for it to display properly as seen on the screenshot below. 
 


Yes, this can be done! The issue you're seeing is because the templating language (likely Liquid, used in many platforms like Zendesk or Shopify) interprets the backslash `\` as an **escape character** for the subsequent `{`. This means it's trying to escape the opening curly brace of your variable, which breaks the variable rendering. felinesounds com

To display a literal backslash, you need to **escape the backslash itself by doubling it**.

Try this in your macro:

`DOMAIN.LOCAL\\{{ticket.requester.first_name}}.{{ticket.requester.last_name}}`

By using `\\`, you tell the templating engine that the first backslash is an escape for the second one, resulting in a single, literal backslash being displayed in your output, followed correctly by your templated variables.