system.kanoa.schedule.scheduleOperation
Description
Schedules an operation that flexibly adheres to the asset's shift schedule, while also avoiding any currently existing schedule blocksSyntax
scheduleOperation(scheduleBlockInfo, scheduleConfig, scheduleOption, userId)Parameters:
Returns:
Dictionary
scheduleBlockInfo| Parameter | Type | Required | Notes | 
|---|---|---|---|
| scheduleBlockName | str | No | Name of the schedule block | 
| assetId | int | No | |
| itemId | int | No | |
| workOrderId | int | No | |
| scheduledQty | int | No | |
| modeId | int | No | |
| startDate | datetime | No | |
| endDate | datetime | No | |
| notes | str | No | |
| rruleStr | str | No | Recurrence rule string (e.g., 'FREQ=DAILY;INTERVAL=1') | 
| color | str | No | 
Dictionary
scheduleConfig| Parameter | Type | Required | Notes | 
|---|---|---|---|
| shiftTimeOnly | bool | No | If True, event times will be adjusted to schedule during shift times | 
| intelligentScheduling | bool | No | When enabled, we will check if the event overlaps with existing events | 
Code Examples
# Example Usage:
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'
scheduleBlockId = system.kanoa.schedule.scheduleOperation(scheduleBlockinfo, scheduleConfig, scheduleOption, userId)
>