Skip to main content
Version: 8.1

system.user.createScheduleAdjustment

This function is used in Python Scripting.

Description​

Creates a schedule adjustment.

Client Permission Restrictions​

Permission Type: User Management

Client access to this scripting function is blocked to users that do not meet the role/zone requirements for the above permission type. This function is unaffected when run in the Gateway scope.

Syntax​

system.user.createScheduleAdjustment(startDate, endDate, isAvailable, note)

Parameters​

TypeParameterDescription
DatestartDateThe starting date of the schedule adjustment.
DateendDateThe ending date of the schedule adjustment.
BooleanisAvailableTrue if the user is available during this schedule adjustment.
StringnoteA note about the schedule adjustment.

Returns​

Schedule Adjustment - A ScheduleAdjustment object that can be added to a user.

Scope​

Gateway, Vision Client, Perspective Session

Code Examples​

Example #1
# Specify the range of the schedule change.
start = system.date.parse("2019-07-01 17:00:00")
end = system.date.parse("2019-07-05 17:00:00")

# Create an adjusted schedule.
scheduleAdjustment = system.user.createScheduleAdjustment(start, end, True, "Summer swing schedule change.")

# Get the user we need to adjust.
user = system.user.getUser("default", "george")

# Apply the adjusted schedule to the temporary user that lives in this script.
user.addScheduleAdjustments([scheduleAdjustment])

# Override the old george user in the user source, with the new user we created in this script.
system.user.editUser("default", user)