Using multi-line text custom user field in macro | Community
Skip to main content

Using multi-line text custom user field in macro

  • October 23, 2017
  • 3 replies
  • 0 views

Gabe11

Hi,

  I have a custom user field for "affected resources" for notifying a user of planned downtime. The multi-line custom user field has line breaks in it, but when I attempt to use it in a macro, the line breaks are removed e.g. :{{ticket.requester.custom_fields.affected_resources}}

However, when I attempt to use this macro, it removes the line breaks, and tab separates the multi-line text.

Ideally, I was trying to format this field as a multi-line bulleted list. Anybody have an idea of how to make this work, or to achieve something similar?

 

Thanks,

  Gabe

 

3 replies

  • November 3, 2017

 

Hey Gabe!

Okay, I just want to make sure that I'm understanding this here. You have a multi-line text field in a customer user field, and you're using a placeholder in a macro to try to put that information in a ticket. Is that right?

Provided that it is, it's a pretty interesting use case. Can you give me more information on exactly what you're trying to accomplish with this workflow? There might be a better way to do this!


Gabe11
  • Author
  • November 8, 2017

Hi Jessie,

  Sorry for the delay. I was able to accomplish this. I used the multi-line text field, but settled on using comma as a delimiter and then used the following(I believe this is Liquid Markup):

{% assign servers=ticket.requester.custom_fields.affected_resources| split: ',' %}

{% for each_server in servers %}

  • {{ each_server }}

{% endfor %}

Basically, I have a user in Zendesk, that is actually a mailing list for all members of a group. The multi-line text field that is a custom field(affected_resources)  stores a list of all the servers that members of this group use. That way when we need to do security patching, we can run a macro that populates a list of these server or affected resources to notify them of maintenance. This was all done so that we can have 1 single macro to use/edit instead of 25, or one for each group.

 

Thanks,

  Gabe


Gabe11
  • Author
  • November 8, 2017

Also, if there's a better way to accomplish this, I'm all ears(or eyes)!