Skip to main content

Using FQL

in FQL Guide
Authors list
Published: 4 Nov 2021|Last updated: 17 Jun 2022

FQL allows us to apply operators to any of the fields listed in the field reference guide to return objects where the field matches the criteria we specify.

Creating an FQL Query

An FQL Query must contain at least two clauses.

  • Field - you must select a field that you wish to base your query on.

  • Value - you must specify a value that you wish that field to match.

Example


To create a query that returns all Tickets that are in the resolved status.

  1. Find the field that holds Ticket status infomation in the field reference guide ticket.status

  2. You then need to find an operator that selects all Tickets where this field shows the Ticket is resolved. Again if you look on the field reference guide next to the tickets.status field we'll see the operator listed as String comparison.

  3. Go to the operators guide and check the operators available for a string comparison. You'll see the options available are=, !=, in, not in.

  4. You'll then need to match the string 'resolved' to the contents of ticket.status. Per the operators list we can use eitherIN OR =

Using IN

ticket.status IN ('resolved')
copy

Using =

ticket.status = 'resolved'
copy

In this instance either of these operators work. However, using IN affords you additional flexibility, as if you decided you wanted to include additional statuses in the query (e.g., archived) it would be very easy to adjust it:

ticket.status IN ('resolved', 'archived')
copy

Adding Multiple Arguments to a Query

It is possible to add multiple arguments to a search using the logical operator AND.

We can use AND to make a search more specific as it allows us to apply the criteria from multiple fields to our query.

Example


To create a query for all resolved Tickets that have been resolved from one department.

  1. Take the query from the previous example to return resolved Tickets ticket.status IN ('resolved').

  2. Go to the field reference guide and find the field that holds the details of the Ticket department ticket.department

  3. Again check the operator for this field in the field reference guide (in this instance it is 'ID ref') and check the operators guide to see the options available (we will use ticket.department = in this instance).

  4. Go to Admin > Ticket Structure > Departments and grab the ID number for your Ticket department.

  5. Add this to your Ticket department query so we have ticket.department = 1 and the original ticket.status IN ('resolved'). We can then simply combine these with AND so our query returns just resolved Tickets from department ID 1.

ticket.status = 'resolved' AND ticket.department = 1
copy
HelpfulUnhelpful

1 of 4 people found this page helpful

next pageUsing Dates with FQL

Please log in or register to submit a comment.