×

ResourceCalendars & Events

OmniPlan is all about tracking how resources are used to accomplish tasks over time. And the most common mechanism for representing an extended period of time is through the use of a resource calendar.

In terms of the scripting architecture of OmniPlan, Resource Calendars are components of Schedules, and every object that has a schedule (projects and resources) also has a default resource calendar object as well. With resources, the project schedule is used if there are no custom events or time allocations for the resource.

With Omni Automation in OmniPlan, scripts can not create external resource calendars or the events they display. However, scripts can access information about an object’s resource calendar and its events and use that information in performing automation tasks.

To access an object’s resource calendar, include a reference to the object’s inherit schedule.

Calendars


actual.schedule.calendars

NOTE: The Calendar class shared by the other Omni applications is also supported in OmniPlan as of v3.13.3 macOS.

Resource Calendars


var rsc = actual.resourceNamed("Bob Jones") if(rsc){ var calNames = rsc.schedule.calendars.map(cal => cal.name) }

ResourceCalendar Instance Properties

Here are the properties of an instance of the ResourceCalendar class:

CalendarEvent Instance Properties

Here are the properties of an instance of the CalendarEvent class:

Events for Specified Resource

As with calendars, calendar events cannot be created with scripts, but data about them can be gathered. The following example script demonstrates how to log information about all of the events for a specified resource.

Log Events for Specified Resource


var rsc = actual.resourceNamed("Bob Jones") if(rsc){ console.log("Events for " + rsc.name) var cals = rsc.schedule.calendars cals.forEach(cal => { var calEvents = cal.events calEvents.forEach(event => { var eventTitle = cal.name + ": " + event.title eventStart = event.start.toString() var eventEnd = event.end.toString() console.log(eventTitle + "\n\t" + eventStart + "\n\t" + eventEnd) }) }) }
Example Log


Events for Bob Jones Project: Extra Work for Bob Wed May 01 2019 17:00:00 GMT-0700 (PDT) Wed May 01 2019 18:00:00 GMT-0700 (PDT) Overtime: Wed May 01 2019 07:00:00 GMT-0700 (PDT) Wed May 01 2019 08:00:00 GMT-0700 (PDT)

In the example shown in the illustration below, the staff (resource) calendar contains two events: the early event (blue shape scheduled @ 7AM) is created in OmniPlan, and the late event (blue shape scheduled @ 6PM) is subscribed from the Project calendar in Calendar application.

subscribed-calendar