Skip to main content
Kinetic Community

Using Remedy Business Time in a Task Tree

This article will discuss how to schedule events in the Task Tree using Business Time as configured in Remedy's Business Time Segment form.

Usage

Scheduling events in the Task Tree based on Business Time requires; a configured "Business Time Segment" in Remedy and the "BMC Execute Process" Task Handler.

The "BMC Execute Process" Handler is used to run the "Remedy Business Time 2" Run Process commands.  This command is calculates an amount of time for a "Wait" Task Handler Node, using a "Business Time Segment".

The "Application-Bus-Time2-Add" process runs the "BMC Execute Process" Handler and calculates a date and time using Business Time.  The Kinetic Task Engine comes with a "Wait" node which can be used in this process to configure when the process should continue or start.  However, it requires an amount of time as a parameter not a date and time.  Therefore, the "BMC Execute Process" Handler is used again with the "Application-Bus-Time2-Diff" process to calculate an amount of time to wait.  This result can then be used by the "Wait" handler.

Example

Attached to this article is a simple example Service Item to show how this method can be used. It uses the same design as described in the "Usage" section above.  The task tree will send out an email 3 Business Days after the Request is completed.  In this example Business Time is configured as Monday thru Friday 8 AM to 5 PM.  The Task process will only take into account business days when sending the email. Therefore, if the request is completed on Friday the email will not be sent until Wednesday. (NOTE: To reduce the Task Handler dependencies of this example, the example doesn't send out an email.  It only contains a placeholder.)

Task Tree Nodes

Set Business Time Segment

This node is the first after the start and only serves as a configuration to define the Instance Id of the Business Time Segment definition to be used by the Task Tree.  This is an entry in the "Business Time Segment" Remedy form where the Business Days and Times are configured. The exact Business Time Segment record is attached to the this article and can be imported onto a Remedy Server.

Calculate 3 Business Days

This node calculates the Date and Time of the when the process should continue.  It runs the "Application-Bus-Time2-Add" command and parameters.  The result of the "Calculate 3 Business Days" node is a date and time in Unix format.

Run Process

Application-Bus-Time2-Add "<%=Time.now.to_i%>" "3" "4" "<%=@results['Set Business Time Segment']['result']%>"

Parameter
Description
<%=Time.now.to_i%> Ruby code to get the current date and time
3 amount of days
4 indicate the previous parameter represents days
<%=@results['Set Business Time Segment']['result']%> references the result of the "Set Business Time Segment" Task Tree node

Calculate Calendar Days for 3 Business Days

The Wait Node is going to requires an amount of time in either min, hours or days, however the previous node returned a date and time in Unix format.  To get an amount of time, the "BMC Execute Process" handler is used again but this time with the Application-Bus-Time2-Diff command and parameters.

Run Process

Application-Bus-Time2-Diff "<%=Time.now.to_i%>" "<%=@results['Calculate 3 Business Days']['Return Value']%>"

Parameter
Description
<%=Time.now.to_i%> Ruby code to get the current date and time
<%=@results['Calculate 3 Business Days']['Return Value']%> the date and time from our previous task node

Wait 3 Days

Now a value representing the amount of time to wait is available for the "Wait 3 Days" Task Tree Note. This node will execute after the amount of appropriate amount of time has passed.  In this example we send a simple email after the passed time.

Wait Time Parameter

<%=(@results['Calculate Calendar Days for 3 Business Days']['Return Value'].to_f / 60).to_i%>

@results['Calculate Calendar Days for 3 Business Days']['Return Value']

Represents the results from the "Calculate Calendar Days for 3 Business Days" Task Tree node.

.to_f

All Task Nodes return a String; to_f is a Ruby Method to conver it to a float

 / 60

divide by 60 to convert it to minutes. 

.to_i

The Ruby Method to_i converts value to an integer.