How to set up a custom SQL alert

Related KB articles:

https://crowsnest.atlassian.net/l/c/RnWg421U

https://crowsnest.atlassian.net/l/c/TpUbrsyF


ALERTS

Alerts let you configure an email alert to be sent on a schedule.

Alerts can be triggered by conditional results of an SQL query.

NOTE: Your email notification server must set up and running inside Crows Nest before email alerts can be sent.


Example: Track low inventory with an alert for parts below a minimum level on a Parts List.

Create an alert called “LOW INVENTORY.”

Open Settings > Alerts

Click “Add new Alert” in top left

Name the new Alert > Enter Description

Select the alert in the left panel and configure...

Timing > when the alert is sent: Starts, Repeats, Ends, Additional Times.

Recipients > right-click to add Employees or email addresses.

Add content under the Body tab (formatting tags available)

Add a query under the SQL tab

(Code example to copy and paste: https://crowsnest.atlassian.net/l/c/G5ZsSSbG)

Options under Body tab

Send Alert even if the Query returns no rows

Include query results in email

Attach query results as CSV file

Query result is already formatted, insert rows to email body as-is.

(If unchecked, results will be converted to HTML table using styles below)


screenshot of the PO Status selection:


Follow these steps to load this Alert.

  1. Add a new Alert and select it on the Alert form

  2. Copy the text from the attached file onto the SQL tab

  3. Right-click the list of Recipients and add yourself (this will be ignored, but one is required for the Alert to run)

  4. Pick a schedule when the Alerts should be sent

The Alert will create a separate notification to each employee that has POs created in the "Ordered" or "Ordered, unconfirmed" statuses that have one or more items with a zero price and the PO date is 3 days or older. The employee must have an email address entered in CN. It will just list out the different PO numbers that need to be reviewed.