Create a Ticket if certain emails do not come In for x number of Days

We have a 3rd party system that emails us alerts. The 3rd party recently had an issue which meant that alerts for one of our customers didn’t come through.

We want to put in a scheduled with the following logic.

  1. Find all x Contracts in AutoTask which include this 3rd Party system
  2. For each contract search for when the last ticket has come in.
  3. Fire a ticket if there have been no alerts when it reaches 7 days
  4. Fire a ticket if there have been no alerts when it reaches 14 days
  5. Fire a ticket if there have been no alerts when it reaches 21 days

Any ideas how I can work out the date between the last ticket that came in and the current days to give a number of days?


Hi @dale

You can render the current date using a “Render Text and Store as Variable” action containing this:

{{date to_tz="Autotask"}} (use the Autotask timezone since you will be comparing to an Autotask timestamp)

You can render the date 7/14/21 days ago with:

{{date subtract="7 days" to_tz="Autotask"}}

{{date subtract="14 days" to_tz="Autotask"}}

{{date subtract="21 days" to_tz="Autotask"}}


{{date subtract="1 week" to_tz="Autotask"}}

{{date subtract="2 weeks" to_tz="Autotask"}}

{{date subtract="3 weeks" to_tz="Autotask"}}

Once you have rendered the date 7/14/21 days ago, you can use an Expression in MSPintegrations to compare the dates:


Instead of querying Autotask for the most recent ticket and comparing its timestamp, you can query Autotask for a ticket that was created within the timeframe. If none are returned, then you know it’s missing.

Thanks Travis. This is what I roughly did. is the first ticket returned in the array the newest ticket created?


is there a way to compare the date a ticket was created with todays date and work out the number of days that have elapsed? As I dont want the same rule firing on day 8, 9, 10 etc

By default, you will receive the first ticket that was created (the oldest ticket). To retrieve the most recent ticket, you should configure the query action to sort the returned tickets by date:

It’s also important to note that the sort is done after the tickets are retrieved from Autotask, and the query can only retrieve 500 tickets at once. You should be sure to limit the query so that it never retrieves more than 500 tickets, or else MSPintegrations will only ever retrieve the 500 oldest tickets and then sort those to find the newest of those oldest tickets.

MSPintegrations doesn’t have any math functions, which would be required for this logic. There is currently no way to compare two dates to calculate the difference.