Skip to main content

How Work Orders Are Generated

A Recurring or Condition template doesn't create work orders by itself. A Kanoa gateway timer does, and knowing how it works explains why a work order can appear a little after it's due, and what to check when one never appears.

The CMMS Schedule Timer​

Kanoa runs a gateway timer called CMMS Schedule, about once a minute. Each run does two things, in this order:

  1. system.kanoa.cmms.checkWorkOrderSchedule() creates the work orders that are due from Recurring templates, including the ones inside each template's Generate Ahead window.
  2. system.kanoa.cmms.checkWorkOrderConditions() creates the work orders whose Condition has been met: run hours, counts or tag values.

You don't need a timer script of your own for either. The timer runs only:

  • on the active gateway, if you have a redundant pair;
  • while Kanoa Maintenance is licensed, or its trial is running;
  • while Enable Kanoa Maintenance is on, under Configuration → Application → Settings.

It checks the last two before every run, so it starts again by itself once the license or the setting is back.

Changing the timer

The Kanoa gateway config page has a Timers tab, where you can turn the CMMS Schedule timer off or give it another interval. A saved interval stays after a restart.

Run It by Hand When Testing​

While you're building templates, you don't have to wait for the timer. Run either check yourself and see how many work orders it created.

Check for due work orders now
  1. Open the Script Console in the Designer.

  2. Run:

    created = system.kanoa.cmms.checkWorkOrderSchedule()
    print 'Recurring work orders created:', created
    created = system.kanoa.cmms.checkWorkOrderConditions()
    print 'Condition work orders created:', created
  3. If either prints more than 0, open Maintenance → Work Orders and find the new work orders.

Both functions sweep every template, the same as the timer does, so running them by hand is safe. A work order that's already been created isn't created twice.

Reference Materials: checkWorkOrderSchedule

This function runs periodically to see if we are ready to generate a workOrder event based on schedule. Evaluates all configured time-based (calendar/interval) work order schedules to determine whether any are due, and generates new work order records for the ones that are ready. Like checkWorkOrderConditions, Kanoa runs this itself about once a minute, on the CMMS Schedule gateway timer, so you don't need a timer script of your own. Call it by hand when testing a Recurring template; each run sweeps every active schedule. It takes no arguments; the schedules it evaluates are the ones already configured in the CMMS (see the scheduleTypeId/scheduleTypeName filters on getWorkOrders).


Parameters​

None


Returns​

ordersGenerated Integer


Example​

ordersGenerated = system.kanoa.cmms.checkWorkOrderSchedule()
Reference Materials: checkWorkOrderConditions

Evaluates all active condition-based work order triggers to determine whether any of them have been satisfied and are ready to generate a new work order event. Kanoa runs this itself about once a minute, on the CMMS Schedule gateway timer (see the Timers tab of the Kanoa gateway config page), so you don't need a timer script of your own. Call it by hand when testing a Condition template; it sweeps the full set of configured conditions each time it runs. It takes no arguments — the conditions it checks are read from the CMMS configuration (see getWorkOrderTriggers) rather than being passed in.


Parameters​


Returns​

numRecordsCreated Integer Number of new work order events created


Example​

# Kanoa's CMMS Schedule timer already runs this; call it by hand to test a Condition template now
created = system.kanoa.cmms.checkWorkOrderConditions()
print created

When a Work Order Doesn't Appear​

Check these, in order:

  1. Is the template Released? Draft templates are never scheduled.
  2. Is Enable Kanoa Maintenance on, and is the license (or trial) active?
  3. Is the CMMS Schedule timer on, on the Timers tab?
  4. For a Recurring template: is the next occurrence inside its Generate Ahead window yet?
  5. For a Condition template: has the asset really passed the threshold since Last serviced on? Run hours only count while it's running.

Then run the checks by hand, as above, and see whether they create it.

You now know what turns a template into work orders, and how to test it without waiting.