HOPCalcTargetDate
This function will be deprecated in a future release, so use it with caution.
However, it is still supported for existing expressions, so it has not been removed from the application. Editing an expression using this function can cause an error message to appear.
Instead of this function, use AddWorkingDays or AddWorkingSeconds.
Calculates the end date and time based on a start date, hours of operation (HOP) schedule, and an interval.
This function takes into account the calendar defined by the reference hours of operation. The hours of operation is based on the tenant rather than the server configuration.
Syntax
HOPCalcTargetDate(hopIdOrName, localStartDateTime, durationInSeconds)
Enabled For
For a description of the business object categories, see Notes on "Enabled For".
Business Object Category | Yes/No |
---|---|
Business Rules: Before-Save Rules | Yes |
Business Rules: Calculation Rules (After Save, with or without Also Recalculate on Load) | Yes |
Business Rules: Calculation Rules (Before Save or Always, without Also Recalculate On Load) | Yes |
Business Rules: Calculation Rules (Before Save or Always, with Recalculate On Load) | Yes |
Business Rules: Editing Rules | Yes1 |
Business Rules: Initialization Rules | Yes |
Business Rules: Read Only Rules | No |
Business Rules: Required Rules | Yes1 |
Business Rules: Validation Rules | Yes |
Client Expressions | No |
Object Permissions | No |
Services | Yes |
LDAP | Yes |
Mobile | Yes |
Quick Actions (except UI Quick Actions) | Yes |
UI Quick Actions | No |
Reports | Yes |
Search/Dashboard without field references | Yes |
Search/Dashboard with field references | No |
1. Except when this field appears on a form or is triggered by such a field. |
Parameters
Parameter | Description |
---|---|
hopIdOrName |
The hours of operation schedule name as defined (for example, 24x7 or 9 to 5). See Setting Up Hours of Operation. |
localStartDateTime |
The starting date and time. |
durationInSeconds |
(Optional) The interval in seconds. If this parameter is not used, it defaults to 0, which means that it returns the very first second of the next work period (operating interval).
You can use basic math operations to calculate the seconds or you can use an expression. |
Return Value
DateTime value.
Example
$(HOPCalcTargetDate("Weekly HOP", CurrentDateTime(), ((12 * 60) * 60)))
This example calculates the date and time for 12 operating hours from the current date and time using the hours of operation schedule called Weekly HOP.