Set company based on subject information

  • 22 September 2022
  • 3 replies

Userlevel 3
Badge +6


I need a bit of guidance on a issue I try to solve.

The situation is as follows.
We have intregrated our NMS with the Alert module of Freshservice. If a device raises an alert, a webhook is triggered to FS and a alert is created, followed by a ticket. The subject of the ticket contains the device name and type of alert.For example “ABC-NL-Amsterdam01 - Link down”. The first part of the device name includes a three letter company reference. The company refenrence can differ as we support multiple companies. Because we use a single web hook in our NMS, we cannot set the company in the Alert rule.

I now try to solve this in the workflow with an event of "Ticket created" and the condition type "alert"  but I'm a bit stuck how to build this workflow in the most effective way.

How can I use the information from the ticket subject to set the company.
The easiest solution but most ineffective way is to created multiple conditions in a row

  1. CONDITION ticket.subject contains ABC - ACTION set company Alphabet and send email to company with alert information ( If no match go to 2)
  2.  CONDITION ticket.subject contains DAF - ACTION set company Car and send email to company with alert information ( If no match go to 3)
  3. CONDITION ticket.subject contains KLM - ACTION set company Airport and send email to company with alert information ( If no match go to 4)

This solution is not really scalable as with 10 companies, I have to create 10 conditions and 10 actions and maintain 10 email templates.

Is there a way to leverage the conditional expressions to have only 1 CONDITION and 1 ACTION module. The logic I have in mind for the condition is

if regexmatch {{subject}} contains ABC, true = Alphabet
    if regexmatch {{subject}}  contains DAF, true = Car
        if regexmatch {{subject}}  contains  KLM, true = Airport

Not sure if this is even possible or that there are other options to get to the same solution.

Hope someone can help me with this. 


Best answer by RichardR 23 September 2022, 18:33

View original

3 replies

Userlevel 7
Badge +16

Hello @RichardR your solution using if statements should totally be doable with the expression builder node. That will give you a result that you can later access through a placeholder and reference it in additional actions of your workflow.

Userlevel 3
Badge +6

@zachary.king Good to know that it is possible. Now I need to find a way to build it. 

I have read through some of your topics and @daniel.soderlund but haven’t found a way to put it all together. 

I took a different approach, with the only limitation that the company short name always has to be in the beginning of the subject.

In the WFA I used the expression to read the first three characters of the subject 


Followed by an App reader that checks a CO that holds the short name “ABC” and a data source that reads the company names. Next I’m using the action to set the company name based on the output of the reader.

This solution scales without the need to update the workflow with every new company. We only need to update the CO, which is not a big deal and can be covered in a process flow. 

Always nice to provide a solution on a topic you started yourself 😂

Userlevel 7
Badge +16

Hey @RichardR  glad you found a solution. Custom Objects is a great solution for a number of business problems, and it does carry the benefit of scaling fairly easy. Great job!