Skip to main content

system.kanoa.schedule.scheduleOperation(scheduleBlockInfo, scheduleConfig, scheduleOption, userId)

Schedules an operation that flexibly adheres to the asset's shift schedule and schedule config settings, while also avoiding any currently existing schedule blocks.


Parameters

scheduleBlockInfo Dictionary

- assetPathString
- endDateDateTime
- startDateDateTime
- timezoneString

scheduleConfig Dictionary

- intelligentSchedulingBooleanWhen enabled, we will check if the event overlaps with existing events
- shiftTimeOnlyBooleanIf True, event times will be adjusted to schedule during shift times

scheduleOption String: i.e. 'default'- does not affect existing events, 'fixed' - modifies overlapping events, 'override' - deletes overlapping events, 'wrap' - wraps around existing events
userId Integer


Returns

addedScheduleBlockIds List of Integers List of new schedule blocks added for this operation
msg String None if successful


Example

scheduleBlockinfo = {
'scheduleBlockName': 'Maintenance',
'assetId': 1,
'itemId': None,
'workOrderId': None,
'scheduledQty': None,
'modeId': 3,
'startDate': system.date.parse("2025-01-01 00:00:00"),
'endDate': system.date.parse("2025-01-07 00:00:00"),
'notes': 'Maintenance notes',
'rruleStr': 'FREQ=DAILY;INTERVAL=1',
'color': '#FF0000'
}
userId = 123
scheduleConfig = {'shiftTimeOnly': True, 'intelligentScheduling': True}
scheduleOption = 'default'
addedScheduleBlockIds, msg = system.kanoa.schedule.scheduleOperation(scheduleBlockinfo, scheduleConfig, scheduleOption, userId)