Recent searches
No recent searches
Liquid Markup Removing Characters in a Dropdown Field
Answered
Posted Apr 13, 2022
I have a custom dropdown field that has the following format:
Model - Inventory Number
Example: Model1 - 141
I want to use liquid markup to keep the model number but remove the hyphen and the inventory number. I've tried various strategies, but to no avail. Does anyone have any suggestions on how to accomplish this?
0
7
7 comments
Dave Dyson
If you're wanting to use Liquid Markup to remove those characters in email output, it looks like you should be able to use the split: option in Liquid – here's an example that removes part of a placeholder's text based on a double colon: How can I format placeholders with liquid markup?
0
Alex Hooper
Thanks for the suggestion, Dave! I saw that article and I've been trying to use the split: option, but I can't get it to work. Also, the use case in the article had to do with nesting, which is similar to my use case, but my values aren't nested. I was hoping I could make it work, but no joy. Still hoping someone has a solution.
0
Jacob the Moderator
Hi Alex,
I believe something like the below should work for your example:
{{ticket.ticket_field_ | split:" -" | first }}
Hope that helps.
0
Alex Hooper
Hey Jacob,
That worked! I was close to the same solution but I was using " - ", instead of " -", which made all the difference. Additionally, being a dropdown, I had to modify your solution slightly.
{{ticket.ticket_field_option_title_ | split:" -" | first }}
Either way. Thanks for the help!
0
Jacob the Moderator
Glad you got it working! 👍
0
Davion Garwood
Too many field when enter model number
0
Dave Dyson
It seems like your correspondence has come to the wrong place! You've reached Zendesk support, and it sounds like you're probably trying to reach someone who *uses* our software to provide support. We make software that companies use to give their customers a way to contact them, but we don't actually provide support for their product, just the channel for communication.
Unfortunately, we are unable to forward your email on so please try reaching them directly from their website!
0