Cartegraph OMS is an enterprise asset management system. Their focus is with government assets like underground pipes, fire hydrants, buildings, and can even deal with custom assets.

Have you ever wanted to group your Preventative Maintenance tasks into a work order? Maybe you need to do some main flushing and you want to group all of the tasks into a work order. Maybe you need to do some sewer main inspections and you want to group them together into a work order. Cartegraph makes it easy to do this through the web interface, but let’s be honest. It isn’t one work order, it might be 20 work orders, and it isn’t 20 tasks, it’s a thousand tasks. A person on the ideas portal asked the question and when I talk to our staff, I hear the same thing. Why can’t my Preventative Maintenace plan create a work order and add all of the tasks into the work order?

Well, you can! Automation Manager to the rescue. Automation Manager is a powerful tool that is a more recent addition to OMS product. It was designed so it’s simple enough for your standard Public Works staff to use, but powerful enough that, when put in the hands a programmer, it can do almost anything. I will be posting a few Automations as I make them that might be useful for others. If there is something you just don’t understand? Ask! 

Are you ready? 

The full automation

Let’s start by breaking this down in concept before we go into how to build it. I made some assumptions and created additional fields to make this work. There needs to be a way for the work order to match up to the plan. This automation will assume that an older work order for the same plan will have been previously closed. If an older work order is still open, it will add the new plan tasks to the older work order and not create a new work order. 

NOTE: Create and test this in a test environment before you create it in live. If something doesn’t run right, it could mess up a lot of data. Always test automations in a test environment before creating them in live.

  • Create a new text field on the Work Order called “Plan Name”. This will allow us to store and find the work order the plan should go into.
  • Create a new automation for After a Task is Created. Give the automation a meaningful name. I called mine “PM/Tasks – Create Work Order from new PM Tasks”.
  • Click on After a task is created and extend the trigger to include “Plan is not empty”. I also added an additional filter to include the department so I could pick and choose what departments this would run for. Note that because I used an “or” I had to use the syntax view.
(([Plan] is not null)) AND 
(([Department] is equal to "Storm Water Utility") OR
([Department] is equal to "Water Distribution") OR
([Department] is equal to "WW Collection") OR
([Department] is equal to "WW Lift Stations"))
  • Add an Aggregate block. We want to Count how many Work Orders that have a Plan Name that matches the Plan field on the Task and make sure that the Status is either “In Progress” or “Planned”.
    • This will allow us to look for any previously created work orders for that plan. This should be 0 or 1 under normal conditions.
  • Add an If block. If the aggregate block above is equal to “0” then you will need to add a Create Record and Notify (optional) block.
  • In the Create Record block, you are setting up your work order. You can customize this to your needs however the Plan Name is required to be filled in order for the rest of this to work. In this example, I am concatenating the Asset Type, Activity, and the Plan Name together to build a description. Here is what I have entered: 
    [eventsource|cgAssetType] + " - " + [eventsource|Activity] + " - " + [eventsource|Plan]
Create Work Order
  • The users wanted to be notified if a new work order was created, so I added the Send Email

So let’s stop here and explain what’s going on. We are looking to see if there is already a work order for this plan. If there is not a work order, we are creating one and letting the users know that there is a new work order. 

  • Now let’s drop in two Loop Records one inside the other. The first one will loop through the Work Orders. We will be looking for the work order we just created. Look for any Work Order with the Status of “In Progress” or “Planned” and the Plan Name is the same as the original tasks’ Plan.
  • In the Second loop, we are looking for Tasks were the Task ID = the original Task ID.
  • Finally, you need two blocks added into the Task Loop. A Set Fields and a Save Record block. In the Set Fields block, you want the record source of the Task loop, and you want to update the Work Order field with the ID
  • For the Save Record, we just need to save the Task loop record 

Here is that this section is doing. We are looking for the created or existing open work order and then looking for the task that was just created in order to update the Work Order field on the task. 

At this point, you should test. I had to create a test PM Plan in our test environment that ran every day until I was comfortable that this automation was working as expected and creating it in live. Take your time and don’t rush so you don’t mess up your data.

There might be slightly better ways to do this, but this has worked for us and is running in live. As I am writing this up, I am seeing things that I am doing that I might not need to do. I’ll have to play with this more and determine if I can improve this automaton. 

Please leave your thoughts on how this works and if you have other ideas on how to improve upon this in the comments below.


No responses yet

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.