MQL Studio
MQL Studio lets you search your Tenant's CaseMagic tickets with MQL, the Magic Suite Query Language. MQL reads like Jira's JQL: you name a field, compare it with a value, and combine conditions with AND and OR. Tickets synced from Jira are searched in the same way as tickets created in CaseMagic.
Note: MQL Studio is available to Tenant Admins only.
Opening MQL Studio
In CaseMagic, select Admin, then MQL Studio. The page has your recent files, example queries and a list of fields on the left, the query editor at the top, and the Results and Messages tabs below it.
Running a query
- Type a query in the editor, or click one of the Examples on the left
- Click Execute, or press Ctrl+Enter
- The matching tickets appear on the Results tab, which MQL Studio switches to from whichever tab you were on
For example, this finds the unresolved Blocker and Critical tickets in the BC project, the most urgent first:
project = "BC" AND priority IN ("Blocker", "Critical") AND resolution IS EMPTY
ORDER BY priority DESC, created
The editor colours keywords, field names, functions, text and numbers, so a misspelt field name stands out because it is not coloured as a field.
The toolbar
The File menu comes first, then the buttons that run a query: Execute and Cancel.
| Button | What it does |
|---|---|
| File | New clears the editor and the results. Open, Open Recent, Save and Save As open and save MQL files in Files, and Restore Auto-Saved brings back MQL that MQL Studio auto-saved. See Opening and saving files, Recent Files, and Auto-save and Restore, below. |
| Execute | Runs the query in the editor. |
| Cancel | Stops the query that is running. It can be clicked only while a query runs. |
| Row limit | The most tickets a query returns: 100, 1,000 or 10,000. The default is 1,000. |
| Download | Downloads the tickets on the Results tab as an Excel workbook (.xlsx) or as CSV, or every message on the Messages tab as a text file. Excel needs at least one ticket. |
| The dot | Green when your MQL is saved, amber when it has changes that are not saved yet. Hover over it to see which, and when the MQL was last auto-saved. |
Opening and saving files
MQL Studio opens and saves queries as .mql files in Files, with the same pop-up as Report Studio.
- Choose File, Open to pick a .mql file and put its MQL in the editor. The pop-up lists only folders and .mql files
- Choose File, Save to save the MQL to the file you opened. MQL that has never been saved asks for a folder and a name, as Save As does
- Choose File, Save As to save the MQL as a new file. The .mql extension is added for you
- The open file's name is shown after MQL Studio at the top of the page. Hover over it to see where it is in Files
- Opening a file, or choosing New, while the dot is amber asks you first, so you can keep your changes
- Loading an example or restoring an auto-save leaves no file open, so Save then asks where to save
- If a file cannot be opened, or you may not save in the folder you chose, a message says why, and the MQL in the editor is kept
Recent Files
MQL Studio keeps the last 10 MQL files you opened or saved. They are kept apart from your recent files in Report Studio and SQL Studio.
- The Recent Files section at the top of the panel on the left shows the last five, newest first. Click one to open it
- Click All recent files... at the end of the section, or choose File, Open Recent, to see all of them in the Recent Files pop-up
- Opening a recent file while the dot is amber asks you first, so you can keep your changes
- Click the arrow beside Recent Files to fold the section away. MQL Studio remembers whether you left it open
The Recent Files pop-up
- Your recent files are grouped by day, the newest first, each with its name, its folder and how long ago you opened it. Hover over one to see exactly when you opened it
- Type in the search box to find a file by any part of its name or folder
- Click a file to preview its MQL, coloured and with line numbers as in the editor
- Click Load to open it in the editor. Double-clicking a file also opens it
- Click Copy to copy its MQL to the clipboard without opening it
- Click Remove from List to take it off your recent files. The file itself is not changed
- A file that has been moved or deleted is marked Not found. It cannot be loaded, but you can remove it from the list
Writing MQL
A condition is a field, an operator and a value, such as status = "Open". Put text values in double or single quotes. A value that is a single word can go without quotes, so status = Open works too.
| Operator | Meaning | Example |
|---|---|---|
| = (or ==) | Is exactly | type = "Bug" |
| != (or <>) | Is not | status != "Done" |
| >, <, >=, <= | Greater or less than, for dates and numbers | estimate > 8 |
| ~ | Contains the words, matched as English words so that "invoice" also finds "invoices" | summary ~ "invoice" |
| !~ | Does not contain the words | summary !~ "test" |
| IN | Is any of a list | priority IN ("Blocker", "Critical") |
| NOT IN | Is none of a list | status NOT IN ("Done", "Closed") |
| IS EMPTY | Has no value | assignee IS EMPTY |
| IS NOT EMPTY | Has a value | duedate IS NOT EMPTY |
- Combine conditions with AND and OR, and put NOT in front of one to reverse it. AND is applied before OR, so use brackets to group:
project = "BC" AND (status = "Open" OR priority = "Blocker") - End a query with ORDER BY and one or more fields to sort the tickets, adding DESC to put the highest or latest first:
ORDER BY priority DESC, created. A query can be only an ORDER BY, which lists every ticket in that order - Keywords and field names can be written in capitals or lower case
- Text compared with = must match exactly, including capitals, so
status = "open"does not find a status of Open. Priorities are the exception and match in any case
Dates
Write a date as year, month and day: created >= "2026-10-01". Dates and times are in UTC.
To work relative to today, use dateTime('UTC', 'yyyy-MM-dd', days), where days is how many days from today: 0 for today, -7 for a week ago and 14 for two weeks ahead. For example, this finds the tickets raised in the last week:
created >= dateTime('UTC', 'yyyy-MM-dd', -7)
Suggestions as you type
As you type, the editor suggests what can come next. Choose one with the arrow keys and Enter or Tab, or click it.
- At the start of a query, and after AND, OR, NOT or an opening bracket, the fields are suggested, from the same list as the fields panel. Custom fields are listed by name and go in as MQL writes them
- After a field, the operators are suggested, each with what it means
- After a complete condition, AND, OR and ORDER BY are suggested, and after ORDER BY and a field, ASC and DESC
- Where a value goes, the dateTime function is suggested, with what its arguments are
- Press Ctrl+Space to see the suggestions without typing
- Nothing is suggested inside a quoted value
Fields
These are the fields MQL knows. Some have other names they can be written as.
| Field | Also written | What it holds |
|---|---|---|
| key | ticketnumber, id | The ticket's key, such as BC-12 |
| summary | name, title | The ticket's summary |
| description | The ticket's description | |
| priority | Blocker, Critical, Major, Minor or Trivial. Sorted from Trivial up to Blocker, so ORDER BY priority DESC puts Blocker first | |
| project | The project's key, such as BC | |
| status | state | The ticket's status, such as Open or In Progress |
| type | issuetype | The ticket's type, such as Bug or Task |
| assignee | The user name of the person the ticket is assigned to | |
| reporter | The user name of the person who reported the ticket | |
| resolution | How the ticket was resolved, such as Done. Empty while the ticket is unresolved | |
| created | When the ticket was created | |
| updated | When the ticket was last changed. Empty for a ticket that has not been changed since it was created | |
| duedate | due | The date the ticket is due |
| estimate | estimatedhours | The estimated hours |
| actualhours | The hours spent | |
| text | The summary and description together, for searching with ~: text ~ "timeout" |
Custom fields are written custom_field_ followed by the field's number, such as custom_field_12, or cf_12 for short. Their values are compared as text. The Custom fields list in the panel shows each one by name and inserts it for you.
Examples and fields panel
The panel on the left holds your recent files (see Recent Files, above), ready-made queries and the fields you can use.
- Hover over an example to see what it finds, and click it to put its MQL in the editor, then click Execute. The MQL that was in the editor is saved first, so Restore can bring it back
- Click the arrow beside Examples to fold the list away and give the fields more room. MQL Studio remembers whether you left it open
- Click a field to insert it into the editor at the cursor. Its type is shown on the right, and hovering over it shows its other names
- Type in the search box to find a field
- Use the arrows at the top of the panel to hide it and give the editor more room
Tip: an example is a starting point. Change it to suit your question, for example the 30 in Not updated for 30 days.
Results
The Results tab shows each matching ticket's key, summary, priority, when it was created and updated, and its due date.
- An empty value (NULL) is shown as NULL in grey italics
- Click a column heading to sort by it. Click again to reverse the order, and a third time to return to the order of the query
The bar under the grid shows the number of tickets and how long the query took. When more tickets matched than the Row limit, it also says "limited to" the number shown.
Messages
The Messages tab keeps a record of everything that happens while the page is open, newest last. A successful query is marked Success with a green tick, and a problem is marked Error in red.
- Choose a level to see only warnings and errors, or only errors
- Type in the search box to find a message
- Click Clear to empty the list
- Choose Download, Messages as text to save every message, with its time and level
Auto-save and Restore
While you work, MQL Studio saves the MQL in the editor at regular intervals, whenever it has changed, so a refreshed page or a closed tab does not lose it. The dot at the right of the toolbar turns green once the MQL is auto-saved, and its ring widens for a moment as each auto-save lands. With a file open, the dot stays amber until you save the file. Hover over it to see when the MQL was last auto-saved. Auto-saves are kept on the server for a set number of days, shown at the top of the Restore pop-up, and only you can restore yours.
- Each visit to MQL Studio keeps one auto-save, updated as the MQL changes. New, or loading an example, starts another, so the MQL from before can still be restored
- Leaving the page while the dot is amber asks you first. With no file open, that is until the MQL is auto-saved, and with a file open, until you save the file
The Restore pop-up
Choose File, Restore Auto-Saved to see your auto-saved MQL. The MQL in the editor is saved first, so nothing is lost.
- Each auto-save is listed by its first line, with how long ago it was saved, how many lines it has and its size. Hover over one to see exactly when it was saved. They are grouped by day, the newest first
- Type in the search box to find an auto-save by any of its MQL
- Click an auto-save to preview it, coloured and with line numbers as in the editor
- Click Restore to put it in the editor
- Click Copy to copy its MQL to the clipboard without loading it
- Click Delete to delete it. You are asked first, as a deleted auto-save cannot be brought back
When a query fails
When MQL Studio cannot run a query, the bar under the results says Error, and the Messages tab gives the reason in red.
- A mistake in the MQL, such as a missing value or a field name MQL does not know, is reported with what was wrong
- A query that runs for more than 30 seconds is stopped. Narrow it with more conditions and try again