Skip to main content

system.kanoa.cmms.addWorkOrderAlertGroups(workOrderId, alertGroupIdList, userId)

Links a work order to one or more alert groups so that members of those groups receive notifications related to the work order (e.g. status changes, overdue alerts, or completion notices, depending on how alert groups are configured elsewhere in the system). Call this when setting up or expanding the notification recipients for a specific work order � for example, right after creating a work order, or when adding an additional team/shift to be kept informed. Pass every alert group id that should be linked in a single call via alertGroupIdList; the function creates one link record per id and reports back how many were successfully created.


Parameters

workOrderId Integer: Id of work order
alertGroupIdList List of Integers: List of alert groups
userId Integer:Id of the user executing the function


Returns

# of records created Integer
msg String None if success


Example

# Link a work order to its escalation and shift-supervisor alert groups
workOrderId = 48213
alertGroupIdList = [12, 15, 21] # e.g. "Maintenance Escalation", "Night Shift Supervisors", "Safety"
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
retVal, msg = system.kanoa.cmms.addWorkOrderAlertGroups(workOrderId, alertGroupIdList, userId)
print retVal, msg