Skip to main content

system.kanoa.cmms.updateWorkOrderScheduleField(workOrderScheduleId, field, value, userId)

Updates a single named field on an existing work order schedule, identified by workOrderScheduleId, to the supplied value. This is a targeted single-field update rather than a full replace � use setWorkOrderSchedule when creating a schedule, and this function for adjusting one field afterward (for example, changing the recurrence rule or pushing out the active date range).


Parameters

workOrderScheduleId Integer: Id of workOrderScheduleId to update
field String: Valid options are workOrderId, rruleStr, startDate, generateAheadDays, lastGeneratedDate
value String: Value to update to
userId Integer:Id of the user executing the function


Returns

# of records modified Integer
message String None if success


Example

workOrderScheduleId = 118
field = "generateAheadDays"
value = 30
userId = system.kanoa.security.getIDPUserId({'userName': 'SYSTEM'})
recordsModified, message = system.kanoa.cmms.updateWorkOrderScheduleField(workOrderScheduleId, field, value, userId)
print recordsModified, message