Skip to main content

We have “SOURCE” shown in our notification emails to agents for FYI purposes but the SOURCE field is showing as a number rather than the text as shown below.

 

Is there a way to get SOURCE to show EMAIL instead of 1 as 1 equals EMAIL?

 

 

I would use a liquid filter, to update the source number to the name. 

 

 


I would use a liquid filter, to update the source number to the name. 

 

 

How ? 


We have “SOURCE” shown in our notification emails to agents for FYI purposes but the SOURCE field is showing as a number rather than the text as shown below.

 

Is there a way to get SOURCE to show EMAIL instead of 1 as 1 equals EMAIL?

 

 

I use an expression to do it; if(‘{{source}}’ == ‘1’,’E-Mail’,if(‘{{source}}’ == ‘2’,’portal’,  etc 


Depends on where you’re doing it, either an expression and the parse the expression resut, or a liquid filter if it’s an email. 

{% case ticket.source %}
  {% when '1' %}E-Mail
  {% when '2' %}Portal
  {% when '3' %}Phone
  {% when '4' %}Chat
  {% when '5' %}Feedback Widget
  {% when '6' %}Outbound Email
  {% else %}Unknown Source
{% endcase %}
 


Depends on where you’re doing it, either an expression and the parse the expression resut, or a liquid filter if it’s an email. 

{% case ticket.source %}
  {% when '1' %}E-Mail
  {% when '2' %}Portal
  {% when '3' %}Phone
  {% when '4' %}Chat
  {% when '5' %}Feedback Widget
  {% when '6' %}Outbound Email
  {% else %}Unknown Source
{% endcase %}
 

Looks much better using case then expression and nested if statement. 


Depends on where you’re doing it, either an expression and the parse the expression resut, or a liquid filter if it’s an email. 

{% case ticket.source %}
  {% when '1' %}E-Mail
  {% when '2' %}Portal
  {% when '3' %}Phone
  {% when '4' %}Chat
  {% when '5' %}Feedback Widget
  {% when '6' %}Outbound Email
  {% else %}Unknown Source
{% endcase %}
 

Looks much better using case then expression and nested if statement. 

It really depends on your usecase, but Freshworks needs to work on expressions and consistency! 


Thanks for the replies but i think i might just take this out of the email to the agents, it seems too complex just for this purpose.

 

@Roxwell you’re right, FreshWorks do really need to make this a lot simpler. I’m starting to pick faults with FreshService now after using for around 3 months.


Thanks for the replies but i think i might just take this out of the email to the agents, it seems too complex just for this purpose.

 

@Roxwell you’re right, FreshWorks do really need to make this a lot simpler. I’m starting to pick faults with FreshService now after using for around 3 months.

More placeholders would be nice. source_id and source_name so you can chose, sometimes you need the number when you do API calls. 


Thanks for the replies but i think i might just take this out of the email to the agents, it seems too complex just for this purpose.

 

@Roxwell you’re right, FreshWorks do really need to make this a lot simpler. I’m starting to pick faults with FreshService now after using for around 3 months.

It’s not perfect, but you can do alot.  If you just paste the liquide filter I gave you above in the email template it will work. 


Thanks for the replies but i think i might just take this out of the email to the agents, it seems too complex just for this purpose.

 

@Roxwell you’re right, FreshWorks do really need to make this a lot simpler. I’m starting to pick faults with FreshService now after using for around 3 months.

It’s not perfect, but you can do alot.  If you just paste the liquide filter I gave you above in the email template it will work. 

I tried this in the body of the email that is sent to the agents:

{% case ticket.source %}{% when '1' %}E-Mail{% when '2' %}Portal{% when '3' %}Phone{% when '4' %}Chat{% when '5' %}Feedback Widget{% when '6' %}Outbound Email {% else %}Unknown Source{% endcase %}

but it gave a blank email. When I took this out of the email template, the body of the email appeared. Must be doing something wrong somewhere.


Thanks for the replies but i think i might just take this out of the email to the agents, it seems too complex just for this purpose.

 

@Roxwell you’re right, FreshWorks do really need to make this a lot simpler. I’m starting to pick faults with FreshService now after using for around 3 months.

It’s not perfect, but you can do alot.  If you just paste the liquide filter I gave you above in the email template it will work. 

I tried this in the body of the email that is sent to the agents:

{% case ticket.source %}{% when '1' %}E-Mail{% when '2' %}Portal{% when '3' %}Phone{% when '4' %}Chat{% when '5' %}Feedback Widget{% when '6' %}Outbound Email {% else %}Unknown Source{% endcase %}

but it gave a blank email. When I took this out of the email template, the body of the email appeared. Must be doing something wrong somewhere.

Strange that I can’t get it work, if you get formatting into the code it could be wrong. 

I tried this and everything ens up Unknown/else 
The if statement use to work. 

 

source {{ticket.source}}



{% case ticket.source %}

{% when '1' %}E-Mail

{% when '2' %}Portal

{% when '3' %}Phone

{% when '4' %}Chat

{% when '5' %}Feedback Widget

{% when '6' %}Outbound Email

{% else %}Unknown Source

{% endcase %}



{% if ticket.source == '3' %}

Phone {{ticket.source}}

{% else %}

Other {{ticket.source}}

{% endif %}

 

 

 


Depends on where you’re doing it, either an expression and the parse the expression resut, or a liquid filter if it’s an email. 

{% case ticket.source %}
  {% when '1' %}E-Mail
  {% when '2' %}Portal
  {% when '3' %}Phone
  {% when '4' %}Chat
  {% when '5' %}Feedback Widget
  {% when '6' %}Outbound Email
  {% else %}Unknown Source
{% endcase %}
 

Looks much better using case then expression and nested if statement. 

It really depends on your usecase, but Freshworks needs to work on expressions and consistency! 

@Roxwell Any chance you can show us or explain where this needs to go please as i’ve had this parked for a couple of weeks but would like to try to get this to work.


Example to your OG post. You add the code direct into the notification template. 

 

Details of the ticket

 

Name: {{placeholder for requester name }}

User’s e-mail: {{placeholder for requester e-mail}}

Organisations(s):

Ticket number: {{place holder for ticket number}}

{% case ticket.source %}
{% when '1' %}Source: E-Mail
{% when '2' %}Source: Portal
{% when '3' %}Source: Phone
{% when '4' %}Source: Chat
{% when '5' %}Source: Feedback Widget
{% when '6' %}Source: Outbound Email
{% else %}Source: Unknown Source
{% endcase %}

or my version (it’s more old style but case is much cleaner and how you should do it if it works. )
 

{% if ticket.source == '1'%}
Source: E-mail
{% elsif ticket.source == '2'%}
Source: Portal
{% elsif ticket.source == '3'%}
Source: Phone
{% elsif ticket.source == '4'%}
Source: Chat
{% elsif ticket.source == '5'%}
Source: Feedback Widget
{% elsif ticket.source == '6'%}
Source: Outbound Email
{% endif %}

Description:{{placeholder for description}}

 

 

 


@shs_tim.hobson  - you literally paste it into the template, and it will magically vanish :D 


@shs_tim.hobson  - you literally paste it into the template, and it will magically vanish :D 

Hi, you need this ? 

source {{ticket.source}}

 

 


The lookup / statement isn’t working with the {% case ticket.source} and I'm getting “Source: Unknown Source” in the notification emails, yet when I query the ticket with a WebRequest i can see that it shows “source”: 2

 

 

And the other way using the elsif is not working either.

 


@shs_tim.hobson 

I should have done some tests before, the placeholder is a number and not string. 

I tested and got this to work. My IF works as well if you remove the ‘ 

{% case ticket.source %} 
{% when 1 %} Source: E-Mail
{% when 2 %}Source: Portal
{% when 3 %}Source: Phone
{% when 4 %}Source: Chat
{% when 5 %}Source: Feedback Widget
{% when 6 %}Source: Outbound Email
{% else %}Source: Unknown Source
{% endcase %}

 


Hello
I have same error
how it fix ?


Hello
I have same error
how it fix ?

Didn’t you get my latest posts solution to work ?


@Daniel Söderlund Thanks for the update, your edit to the script works.

 

@iufore, Add the following to a email notification template or to an email template. You can use a Web Request with a GET and the endpoint of “freshservice.com/api/v2/tickets/{{ticket.id_numeric}}” to query the tickets to show you which source number correlates to the source. I have some custom source items which are 1001, 1002, 1004.

#Your text above this line#
{% case ticket.source %}
{% when 1 %}Source: Email
{% when 2 %}Source: Portal
{% when 3 %}Source: Phone
{% when 4 %}Source: Chat
{% when 1001 %}Source: Called into Office
{% when 1002 %}Source: In Person
{% when 1004 %}Source: Internal IT Task
{% endcase %}
#Your text below this line#

 


Reply