- Home [object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
- Getting started
- Use cases
-
API
- Object types
- Data types
-
Global constants
- Application
- ApplicationUserProfile
- ApplicationWithBatcher
- ApplicationWithParams
- BrandingSettings
- CompanyInfo
- Converter
- Directories
- Files
- HttpApiHandler
- HttpApiRequest
- ICache
- IStorage
- MailMessage
- Mailbox
- OrganisationStructure
- OrganisationStructureTree
- Portal
- PortalPageInfo
- PortalSettings
- Portals
- Process
- Processes
- ProductionSchedule
- Reminders
- Replacements
- Serial
- ServerCollection
- Service
- SignupUrlParams
- SystemCollections
- SystemCollectionsWithEvents
- SystemCollectionsWithFilterEvents
- Templater
- Translator
- UserGroups
- Users
- Watermarks
- Report
- Reports
- SR
- Work with apps
- Web requests
- Access permissions
- Document flow
- Live Chats
- “Code” widget
- Signatures
- Business calendars
- Integration with IP telephony
- Integration with email marketing services
Business calendar object
Used to get the settings of the business calendar, such as:
Hierarchy
Properties
Readonly specialCalendars
Object for working with calendars of exceptions.
Readonly workCalendars
Object for working with business calendars.
Methods
calcDate
The method calculates a date inside the working time interval.
The date is calculated from the specified date and with the specified duration. If a user is provided, the calculation will use the business calendar associated with that user. Otherwise, the default calendar specified for the company as a whole will be used. For example, you can calculate date within working hours will be 14 hours after the process start date:
const workingTime = await System.productionSchedule. calcDate(Context.data.__createdAt, new Duration(14, 'hours'));
Important: the
time
parameter must be a multiple of minutes. The result is an object of theTDatetime
type, with the same time zone as the input parameterfrom
.Parameters
from: TDatetime
time: number | TDuration
Optional user: TUser
Returns Promise<TDatetime>
deleteSpecialDays
Delete exceptions in the default business calendar.
Example of deleting short days and public holidays:
await System.productionSchedule.deleteSpecialDays([ new TDate(2023, 12, 31), new TDate(2023, 12, 30), ]);
Parameters
dates: TDate[]
Returns Promise<void>
getGeneralSettings
The method returns the general settings of the business calendar.
General settings of the Business Calendar include work schedule and non- working days of the week.
const generalSettings = await System.productionSchedule.getGeneralSettings();
Returns Promise<ProductionScheduleGeneralSettings>
getSpecialDays
The method gets short days and public holidays from the business calendar.
Sort days and public holidays are returned for a certain period specified
in the method's arguemnts:
Parameters
from: TDatetime | TDate
to: TDatetime | TDate
Returns Promise<ProductionScheduleSpecialDay[]>
getWorkingTime
The method is used to get the duration of working time within a specified period.
The working hours duration is returned for the period passed in the method’ s arguments. If a user is provided, the calculation will use the business calendar associated with that user. Otherwise, the default calendar specified for the company as a whole will be used.
Parameters
from: TDatetime
to: TDatetime
Optional user: TUser
Returns Promise<TDuration>
saveGeneralSettings
The method allows you to modify the general settings of the default business calendar, that is, the calendar specified in the company settings.
Example of editing the settings:
const settings = await System.productionSchedule.getGeneralSettings(); settings.weekends = { monday: false, tuesday: false, wednesday: false, thursday: false, friday: false, saturday: true, // Saturday is a non- working day sunday: true, // Sunday is a non-working day } await System.productionSchedule.saveGeneralSettings(settings);
Parameters
settings: ProductionScheduleGeneralSettings
Returns Promise<void>
saveSpecialDays
Create or edit exceptions in the default business calendar.
Example of creating short days and public holidays:
await System.productionSchedule.saveSpecialDays([ { date: new TDate(2023, 12, 30), holiday: false, from: 16 * 60 * 60, // From 4 pm to: 18 * 60 * 60, // To 6 pm }, { date: new TDate(2023, 12, 31), holiday: true, // Holiday from: 0, to: 0, }, ]);
Parameters
specialDays: ProductionScheduleSpecialDay[]
Returns Promise<void>
Properties
Methods