# system.kanoa.event.assetOperationChange(assetOperationInfo, userId)

Call this function whenever the mode on an asset changes. Will set all child assets to the same mode if includeChildren is true

---
### Parameters
**assetOperationInfo** `dict.`: All keys are required unless otherwise stated.<br />
<table class='dictionaryKeyTable'>
	<tbody>
 	<tr><td> - assetId</td><td>Integer</td><td></td></tr>	
 	<tr><td> - checkAssetSchedule</td><td>Boolean</td><td>Not required. If true, the schedule will be checked after setting the mode. If not set, will be set to false,</td></tr>	
 	<tr><td> - includeChildren</td><td>Boolean</td><td> Not required. If not set, will be set to false</td></tr>	
 	<tr><td> - itemId</td><td>Integer</td><td></td></tr>	
 	<tr><td> - modeCode</td><td>Integer</td><td></td></tr>	
 	<tr><td> - modeSourceId</td><td>Integer</td><td>Source of the mode change (id for operator, plc, schedule)</td></tr>	
 	<tr><td> - setChildModeOnly</td><td>Boolean</td><td>Not required. If false, then itemId will also be set on child assets. If not set, will be set to true.</td></tr>	
 	<tr><td> - standardRate</td><td>Float</td><td>Not required. If not set or None, the standardRate for the assetItem will be used. Allows the standardRate to be adjusted say based on the number of workers on the line</td></tr>	
 	<tr><td> - tStamp</td><td>DateTime</td><td></td></tr>	
 	<tr><td> - workOrderId</td><td>Integer</td><td></td></tr>	
	</tbody>
</table>

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

---
### Returns
**modeEventId** `Integer`<br />
**message** `String` None if successful<br />

---
### Example
```python
assetOperationInfo = {
	'assetId': 13, 
	'modeCode': 1, 
	'workOrderId': None, 
	'itemId': 3, 
	'standardRate': 100.0, 
	'modeSourceId': 1, 
	'tStamp': system.date.now(), 
	'includeChildren': True,
    'setChildModeOnly': True
	}
modeEventId, msg = system.kanoa.event.assetOperationChange(assetOperationInfo, userId)
if msg: system.perspective.sendMessage('showWarningToast', {'message': 'Could not change asset mode. %s'%msg})
else: system.perspective.sendMessage('showSuccessfulToast', {'message': 'Asset has been set to %s'%values['mode']})
```
