# system.kanoa.schedule.addScheduleBlock(scheduleBlockInfo, userId)

Adds a new scheduleBlock. All scheduleBlockInfo keys are required

---
### Parameters
**scheduleBlockInfo** `Dictionary`<br />
<table class='dictionaryKeyTable'>
	<tbody>
 	<tr><td> - assetId</td><td>Integer</td><td>Id of the asset associated with the schedule block</td></tr>	
 	<tr><td> - color</td><td>String</td><td>Color code for the schedule block</td></tr>	
 	<tr><td> - endDate</td><td>DateTime</td><td>End date of the schedule block</td></tr>	
 	<tr><td> - itemId</td><td>Integer</td><td>Id of the item associated with the schedule block or None</td></tr>	
 	<tr><td> - modeId</td><td>Integer</td><td>Id of the mode associated with the schedule block</td></tr>	
 	<tr><td> - notes</td><td>String</td><td>Additional notes for the schedule block</td></tr>	
 	<tr><td> - rruleStr</td><td>String</td><td>Recurrence rule string (e.g., 'FREQ=DAILY;INTERVAL=1')</td></tr>	
 	<tr><td> - scheduleBlockName</td><td>String</td><td>Name of the schedule block</td></tr>	
 	<tr><td> - scheduledQty</td><td>Integer</td><td>Quantity to be scheduled</td></tr>	
 	<tr><td> - startDate</td><td>DateTime</td><td>Start date of the schedule block</td></tr>	
 	<tr><td> - workOrderId</td><td>Integer</td><td>Id of the work order associated with the schedule block or None</td></tr>	
	</tbody>
</table>

**userId** `Integer`:Id of the user executing the function<br />

---
### Returns
**scheduleBlockId** `Integer`<br />

---
### Example
```python
scheduleBlockInfo = {
                        'scheduleBlockName': 'Maintenance', 
                        'assetId': 1, 
                        'itemId': None, 
                        'workOrderId': None, 
                        'scheduledQty': None, 
                        'modeId': 3, 
                        'startDate': system.date.parse('2025-11-05 06:00:00'), 
                        'endDate': system.date.parse('2025-11-05 09:00:00'), 
                        'notes': 'Maintenance notes', 
                        'rruleStr': 'FREQ=DAILY;INTERVAL=1', 
                        'color': 'FF0000'
                        }
userId = 123
scheduleBlockId = system.kanoa.schedule.addScheduleBlock(scheduleBlockInfo, userId)
```
