This documentation supports the 9.1 version of Remedy Action Request System.

To view the latest version, select the version from the Product version menu.

Business Time application commands

This topic explains the following Business Time application commands:

Application-Bus-Time2-Add

The Application-Bus-Time2-Add command adds the requested offset to the start time and returns a timestamp representing the time calculated. Use this command to recalculate time into the future.

Syntax

Application-Bus-Time2-Add *"*startTime" ["<amount>" ["<amountUnits>" ["<businessTimeSegmentName1>" " <businessTimeSegmentName2>" . . . ]]] 

Description of parameters

  • startTime: Required parameter. It is the starting time to which to add business time. It must be a value such as a field reference ($<fieldName>$). Other fields are optional and use the default value if not provided. You can specify multiple business activity names.
  • amount: Specifies an amount of time to offset the start time by. It can be an integer value of 0 or greater. If not specified, this parameter defaults to 1. You can use 0 to indicate the next available time. For example, if your open hours are 8:00 A.M. to 5:00 P.M. and the Start Time in Application-Bus-Time2-Add, Application-Bus-Time2-Assoc-Add, and Application-Bus-Time-Add commands is 7:00 A.M., the return value is 8:00 A.M.

    Note: In the previous versions, this parameter was known as <offset>.

  • amountUnits: The unit of time, which can be set to 1 for seconds, 2 for minutes, 3 for hours, or 4 for days. Any other setting reverts to hours (3).
  • businessTimeSegmentName: Indicates which entry in the Business Time Segment form contains a definition for the activity to use for this calculation. You can specify multiple business activity names. Omitting this value specifies that no business activity is used for this calculation.

Example

To add one day, use the following calculation: $PROCESS$ Application-Bus-Time2-Add "$<fieldName>$" "<amount>" "<amountUnits>"

This adds one day to the value in <fieldName>. In the example, <fieldName> is <startTime><amount> (offset) is set to 1, and <amountUnits> is set to 4 (representing days), thus adding 1 day to the calculation.

The final syntax looks like:
$PROCESS$ Application-Bus-Time2-Add "$8/26/2004$" "1" "4"

Application-Bus-Time2-Diff

The Application-Bus-Time2-Diff command computes the difference between the start time and the end time. It returns an integer representing the difference in seconds. Use this command to compare two different times (start time and end time) to get the actual business time.

Syntax

Application-Bus-Time2-Diff "<startTime>" "<endTime>" ["<businessTimeSegmentName1>" "<businessTimeSegmentName2>" . . . ]]

Description of parameters

  • startTime: Required parameter. It is the starting time to which to add business time. It must be a value such as a field reference ($<fieldName>$). Other fields are optional and use the default value if not provided. You can specify multiple business activity names.
  • endTime: Required parameter. It is the ending time of the interval of which to calculate the difference. Other fields are optional and use the default value if not provided. You can specify multiple business activity names.
  • businessTimeSegmentName: Indicates which entry in the Business Time Segment form contains a definition for the activity to use for this calculation. You can specify multiple business activity names. Omitting this value specifies that no business activity is used for this calculation.

Application-Bus-Time2-Subtract

The Application-Bus-Time2-Subtract command subtracts the requested offset from the start time and returns a timestamp representing the time calculated. Use this command to recalculate time in the past.

Syntax

Application-Bus-Time2-Subtract "<startTime>" ["<amount>" ["<amountUnits>" ["<businessTimeSegmentName1>" "<businessTimeSegmentName2>" . . . ]]] 

Description of parameters

  • startTime: Required parameter. It is the starting time from which to subtract business time. It must be a value such as a field reference ($<fieldName>$). Other fields are optional and use the default value if not provided. You can specify multiple business activity names.
  • amount: Specifies an amount of time to offset the start time by. It can be an integer value of 0 or greater. If not specified, this parameter defaults to 1. You can use 0 to indicate the next available time. For example, if your open hours are 8:00 A.M. to 5:00 P.M. and the Start Time in Application-Bus-Time2-Add, Application-Bus-Time2-Assoc-Add, and Application-Bus-Time-Add commands is 7:00 A.M., the return value is 8:00 A.M.

    Note: In the previous versions, this parameter was known as <offset>.

  • amountUnits: The unit of time, which can be set to 1 for seconds, 2 for minutes, 3 for hours, or 4 for days. Any other setting reverts to hours (3).
  • businessTimeSegmentName: Indicates which entry in the Business Time Segment form contains a definition for the activity to use for this calculation. You can specify multiple business activity names. Omitting this value specifies that no business activity is used for this calculation.

Example

To subtract one day, use the following calculation: $PROCESS$ Application-Bus-Time2-Subtract "$<fieldName>$" "<amount>" "<amountUnits>"

This subtracts one day from the value in <fieldName>.

In the example,

<fieldName> is <startTime><amount> (offset) is set to 1, and <amountUnits> is set to 4 (representing days), thus subtracting 1 day from the calculation.

The final syntax looks like:
$PROCESS$ Application-Bus-Time2-Subtract "$8/26/2004$" "1" "4"

Application-Bus-Time2-Get-Next-Window

The Application-Bus-Time2-Get-Next-Window command returns the start of the next available or unavailable time segment that is <duration> seconds long. If <duration> is 0 (the default), the command returns the start of available time segment or the start of unavailable the time segment.

Additionally, depending on the <windowFlag>, the command returns one time segment or all the time segments between

<startTimeRange> and <endTimeRange>

Syntax

Application-Bus-Time2-Get-Next-Window "<startTimeRange>" "<endTimeRange>" ["<duration>"] ["<windowFlag>"] ["<businessTimeSegmentName1>" "<businessTimeSegmentName2>" . . . ]

Description of parameters

  • startTimeRange: A date and time value that defines the start of a search for a time window.
  • endTimeRange: A date and time value that defines the end of a search for a time window.
  • duration: Specifies the size of the time segment in seconds. Specify 0 to return the next time segment.
  • windowFlag: A bitmask value with Bit 0 and Bit 1.
    Bit 0 indicates the beginning of an available or unavailable time segment. The values are 1 (available) and 0 (unavailable).
    Bit 1 indicates whether to retrieve just one segment or all the segments between the start and end times. The values are 1 (retrieve all segments) and 0 (retrieve one segment). The value returned in this case is a semicolon-separated list of values.
  • businessTimeSegmentName: Indicates which entry in the Business Time Segment form contains a definition for the activity to use for this calculation. You can specify multiple business activity names. Omitting this value specifies that no business activity is used for this calculation.

Application-Bus-Time2-Get-Free-Window

The Application-Bus-Time2-Get-Free-Window command returns the start of the next available or unavailable free time segment at the same level or a higher level that is <duration> seconds long.

A free time segment at Level <level> and Duration <duration> is one where no other time segment at the same or higher level as <level> overlaps, or starts or ends in the <duration> of this time segment.

After a free time segment is obtained, it can be created as available or unavailable. The default value for <duration> is 0, which returns the next available time segment.

Note: This command considers all Business Time Segments at a certain level or above and treats them as unavailable, regardless of whether they are available or unavailable. If Level 1 and 2 time segments are present, they are always considered and are taken as available and unavailable, respectively.

Syntax

Application-Bus-Time2-Get-Free-Window "<startTimeRange>" "<endTimeRange>" ["<level>"] ["<duration>"] ["<earliestStartTime>"] ["<latestEndTime>"] ["<businessTimeSegmentName1>" "<businessTimeSegmentName2>" . . . ]

Description of parameters

  • startTimeRange: A date and time value that defines the start of a search for a time window.
  • endTimeRange: A date and time value that defines the end of a search for a time window.
  • level: Indicates the level of the time segment to be scheduled. The value can be an integer from 1 through 1000.
  • duration: Specifies the size of the time segment in seconds. Specify 0 to return the next time segment.
  • earliestStartTime: Working in conjunction with the <latestEndTime>, specifies the time range within which the free window should exist. The specified duration (<duration> parameter) must be less than this range.
    For example, if the earliest time is 4:00 P.M. and the latest end time is 10:00 P.M., a window is returned that is <duration> seconds long and starts after 4:00 P.M., even if a window exists before 4:00 P.M. If the duration is greater than the specified time range, no value is returned. If the <earliestStartTime> is not specified, the default of 0 hours (the beginning of the day) is used.
  • latestEndTime: Working in conjunction with the <earliestStartTime>, specifies the time range within which the free window should exist. The specified duration (<duration> parameter) must be less than this range. For example, if the earliest time is 4:00 P.M. and the latest end time is 10:00 P.M., a window is returned that is <duration> seconds long and starts after 4:00 P.M., even if a window exists before 4:00 P.M. If the duration is greater than the specified time range, no value is returned. If the <latestEndTime> is not specified, the default of 24 hours (midnight) is used.
  • businessTimeSegmentName: Indicates which entry in the Business Time Segment form contains a definition for the activity to use for this calculation. You can specify multiple business activity names. Omitting this value specifies that no business activity is used for this calculation.
Was this page helpful? Yes No Submitting... Thank you

Comments

  1. Mohammad Rehman

    Recently I see there are no proper examples for newbies to understand these business time calculations. Example is half way through it does not explain the further businessTimesegmentsName parameters.

    Please add proper examples for each Application-Business time commands with all parameters usage and where these parameters are defined.

     

    May 15, 2017 01:05
    1. Nidhi Das

      Hello Mohammad,

      I will discuss this with the concerned SME and will update the topic.

      Regards,
      Nidhi

      May 16, 2017 12:26
      1. Anagha Deshpande

        Hello Mohammad,

        Apologies for responding late.

        You can refer to Application-Bus-Time2-Get-Free-Window scenarios for examples and the parameters are explained in this topic.

        Regards,

        Anagha

         

        Aug 02, 2017 12:14
    1. Ariel Manka

      I second this comment. Parameters are terribly explained here. Not just for newbies. Even examples in the link provided by Anagha are not very helpful.

      Sep 13, 2018 02:45
      1. Anagha Deshpande

        Hello Ariel,

        Apologies for the inconvenience.

        We will update the topic soon.

        Regards,

        Anagha


        Sep 13, 2018 10:31
  2. Fernando Galicia

    From which form do I obtain these parameters?

    [“” “” . . . ]]

    I need to eliminate weekends and holidays

    Jan 15, 2018 05:11
    1. Anagha Deshpande

      Hello Fernando,

      Apologies for the inconvenience. I am checking this with the SME. Will respond soon.

      Regards,

      Anagha

      Jan 15, 2018 09:11
  3. Jan Bassa

    Hi Anagha,

    Am I right that the field used to find the time Segment Need to be a DateTime field? We have seen Errors when not using this and using different time settings, such as German.

    Apr 13, 2018 05:07
    1. Anagha Deshpande

      Hello Jan,

      I will confirm this with the SME and will respond back.

      Regards, Anagha

      Apr 15, 2018 09:30
      1. Anagha Deshpande

        Hello Jan,

        The field used to find business time segment must be a DateTime field.

        Regards,

        Anagha

        Jul 06, 2018 12:08