Next Topic

Previous Topic

Book Contents

IF-ELSE-STEP Service Desk Commands

The following is a summary of IF-ELSE and STEP statements used in Service Desk procedures.

IF-ELSE Statements

Check a Variable

Evaluate a given variable.

Tests for Duplicate Requests

Compares inbound email to determine if it is a duplicate of an existing ticket.

Test a Custom Field of the Ticket

Compares a custom field value in a ticket to a specified value or variable.

Test a Property Value of the New Ticket

Compares the value of a field in a ticket to a specified value or variable.

Test a Property Value of the Receipt

Compares the value of a field in an inbound email to a specified value or variable.

STEP Statements

Add a Note

Adds a note to the ticket being processed by the procedure.

Assign Ticket Custom Field

Assigns a value to a custom field in a ticket.

Assign Ticket Property

Assigns a value to a field in a ticket.

Delete a Ticket

Deletes the ticket being processed by the procedure.

Execute a Common Sub-Procedure

Starts another procedure.

Execute Shell Command

Executes a shell command on the KServer

Fails the Current Ticket Transaction

Changes made to a ticket are not saved to the database.

Get a Variable

Gets a entered value or a value from a file stored on the KServer.

Link to Another Ticket

Associate another ticket with the ticket being processed.

Pause Stage Goal

Pause counting elapsed time against the stage goal.

Pause Ticket Goal

Pause counting elapsed time against the ticket goal.

Resume Stage Goal

Resume counting elapsed time against the stage goal.

Resume Ticket Goal

Resume counting elapsed time against the ticket goal.

Schedule Procedure

Runs a selected agent procedure for a specified machine.

Send Email

Sends an email to one or more recipients.

Send Message

Sends a message to the inbox of a user.

Send Message to Pool Users

Sends a message to the inbox of each user included in a pool.

Set Escalation Time

Sets the time a ticket is escalated.

Set Goal Time

Sets the time a ticket or stage goal is scheduled to be completed.

Set Ticket Goal Time

Set the due date for the entire ticket.

Write Procedure Log Entry

Writes an entry to System > Application Logging.

Where Used

These IF-ELSE and STEP statements are used by the following types of Service Desk procedures.

IF-ELSE Statements

Stage Entry or Exit

Ticket Change

Ticket Request De-Dup

Ticket Request Mapping

Ticket Goals

Ticket Escalations

Sub-Procedures

Check a Variable

Tests for Duplicate Requests

 

 

 

 

 

 

Test a Custom Field of the Ticket

 

Test a Property Value of the New Ticket

 

Test a Property Value of the Receipt

 

 

 

 

 

 

STEP Statements

Stage Entry or Exit

Ticket Change

Ticket Request De-Dup

Ticket Request Mapping

Ticket Goals

Ticket Escalations

Sub-Procedures

Add a Note

 

Assign Ticket Custom Field

 

Assign Ticket Property

Delete a Ticket

 

Execute a Common Sub-Procedure

Execute Shell Command

Fails the Current Ticket Transaction

 

 

Get a Variable

Link to Another Ticket

 

Pause Stage Goal

 

 

Pause Ticket Goal

 

 

Resume Stage Goal

 

 

 

Resume Ticket Goal

 

 

Schedule Procedure

Send Email

Send Message

Send Message to Pool Users

 

Set Escalation Time

 

Set Goal Time

 

Set Ticket Goal Time

 

 

Write Procedure Log Entry

IF-ELSE in Detail

Check a Variable

Enter the name of the variable in the format #var_name#. It can be a global variable or a procedure variable that was defined earlier in the current procedure or a parent procedure. If a global variable, then the global variable's Set value must be compatible with the procedure being run. See Procedure Variables and Working with Variables for more information about variables.

Enter a string comparison operator. The same string comparison options are available for all IF commands. See String Comparisons and Date/Time Comparisons.

Then enter a second value to compare against the first value. Instead of a value you can also enter a object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables.

If the test is true, IF steps are executed. If the test is false, ELSE steps are executed.

Tests for Duplicate Requests

This IF command is only available in a Ticket Request De-Dup procedure.

Tests a ticket request to see if it is a duplicate of any existing ticket. Prevents multiple tickets from being created for the ticket request, within a specified time limit.

Ticket requests are created when Service Desk receives a request to create a ticket. Ticket requests are based on either an inbound email or system event, such as alarm conditions. Incoming Email Settings and linked service desk procedures determine how ticket requests are processed into tickets, what service desks are used to create the tickets, and whether ticket requests are canceled.

Tests true if one or more of the following conditions are matched:

  • Match the submitter name
  • Match the submitter email address
  • Match the request subject
  • Match the source type
    • 0 – Counter
    • 1 – Service
    • 2 – Process
    • 3 – SNMP
    • 4 – Alert
    • 5 – System Check
    • 6 – KES
    • 7 – Log Parser
  • Match the first reference field. Refers to the event ID and value ID of an event log alert.
  • Match the second reference field. Refers to the alert log type, which is either a system check or an event log alert. Event log alerts are classified as "6 = custom" log type alerts.
    • 1 = web server check
    • 2 = dns check
    • 4 = port check
    • 5 = ping
    • 6 = custom
  • Match the machine
  • Match the machine group

Limits matching to the most recent <N> number of periods, based on the ticket creation date.

Test a Custom Field of the Ticket

Enter the name of the custom field in the format custom_field, without bracket characters of any kind.

Enter a string comparison operator. The same string comparison options are available for all IF commands. See String Comparisons and Date/Time Comparisons.

Then enter a second value to compare against the first value. Instead of a value you can also enter a object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

If the test is true, IF steps are executed. If the test is false, ELSE steps are executed.

Test a Property Value of the New Ticket

Select a ticket property from the drop-down list, in the format objectname, without bracket characters of any kind.

Enter a string comparison operator. The same string comparison options are available for all IF commands. See String Comparisons and Date/Time Comparisons.

Then enter a second value to compare against the first value. Instead of a value you can also enter a object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

If the check is true, IF steps are executed. If the check is false, ELSE steps are executed.

Test Property Value of the Receipt

This IF command is only available in a Ticket Request Mapping procedure.

Select a ticket property from the drop-down list, in the format objectname, without bracket characters of any kind.

Enter a string comparison operator. The same string comparison options are available for all IF commands. See String Comparisons and Date/Time Comparisons.

Then enter a second value to compare against the first value. Instead of a value you can also enter a object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

If the test is true, IF steps are executed. If the test is false, ELSE steps are executed.

SourceType, SourceTag and SourceValue Properties

The SourceType, SourceTag and SourceValue properties are populated when ticket creation is triggered by a system event and Service Desk integration is activated. For example, various types of alarms conditions can trigger the creation of a ticket. The following table shows how the SourceType and three SourceTag fields are populated by a variety of alarm conditions. The SourceValue columns—not shown in this table—contain the specific values that correspond to these SourceTag fields.

SourceType

SourceTag1

SourceTag2

SourceTag3

Event Log

agentguid

alertid

EventId

Counter

agentguid

monitorobjectid

monitorvalue

Agent Offline

agentguid

alertid

 

Service

agentguid

monitorobjectid

monitorvalue

New Patch

agentguid

alertid

 

Agent Credential Invalid

agentguid

alertid

 

Alert

agentguid

monitorobjectid

 

Win AU Change

agentguid

alertid

 

RAM Change

agentguid

alertid

 

Disk Drive Change

agentguid

alertid

 

Agent Online

agentguid

alertid

 

PCI Card Change

agentguid

alertid

 

System Check

agentguid

alertid

 

String Comparisons

The string comparisons performed in IF commands are not case sensitive. The available tests are:

  • Exists : true if the variable exists and the variable has a non-empty value
  • Does Not Exist : true if the variable does not exist or the variable has an empty value
  • Is Equal To : true if value of the variable equals the test value.
  • Is Not Equal To : true if value of the variable does not equal the test value.
  • Is Greater Than : true if value of the variable is greater than the test value.
  • Is Greater Than or Equal To : true if value of the variable is greater than or equal to the test value.
  • Is Less Than : true if value of the variable is less than the test value.
  • Is Less Than or Equal To : true if value of the variable is less than or equal to the test value.
  • Contains : true if the test value is a sub string of the variable (variable must be a string).
  • Does Not Contain : true if the test value is not a sub string of the variable (variable must be a string).

For the tests Is Equal To, Is Not Equal To, Is Greater Than, Is Greater Than or Equal To, Is Less Than, and Is Less Than or Equal To the variables compared may be a string, a number, a date in the format of yyyy/mm/dd or yyyy/mm/dd hh:mm or yyyy/mm/dd hh:mm:ss, or a version number containing dots or commas such as 1.2.3 or 4,5,6,7. If a date format is specified, it may be offset using + dd:hh:mm:ss or - dd:hh:mm:ss. Only dd days are required; hh hours, mm minutes, and ss seconds may be omitted and are assumed to be zero when absent.

Date/Time Comparisons

You can use an IF statement to test whether a time relative to the current time is true or not. Relative time is specified as [-][d.]hh:mm:ss where d is the number of days, hh is the number of hours, mm is the number of minutes, and ss is the number of seconds . Specifying a in front causes a time in the past to be calculated. Thus -1:00:00 means one hour ago, -3.12:45:08 means three days, 12 hours, 45 minutes, and 8 seconds ago. Notice that days has a period just after it instead of a colon. Specifying d and - are optional. These times do not take into account hours coverage associated with a policy. For example, an IF statement can test to see whether a ticket's create date/time is older than 3 days. The first value is CreateDateTime, the operator is Is Less Than, and the comparison value is -3.00:00:00.

STEP in Detail

Add a Note

Adds a note to the ticket being processed by the procedure. You choose to make the note hidden or not.

Select a note template instead of entering a note.

Note text can include an object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

Assign Ticket Custom Field

Assigns a value to a custom field in a ticket. Enter the name of the custom field in the format custom_field, without bracket characters of any kind. Then enter a value that matches the range of possible values allowed for this custom field. The range of possible values is specified using the Service Desk > Definitions > Properties > Custom Fields tab.

You can also enter a object variable in the format [$objectname$] or a global variable or procedure variable in the format [=var_name=]. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

Assign Ticket Property

Assigns a value to the property of a ticket. The set of properties that can be assigned are displayed in a drop-down list. The supplied value may be a global variable name or procedure variable name in the format [=var_name=]. See Procedure Variables and Working with Variables for more information about variables.

Delete a Ticket

Deletes the ticket being processed by the procedure.

Execute a Common Sub-Procedure

Causes a sub-procedure to execute. Use this capability to string multiple IF-ELSE clauses together. You can nest the execution of procedures to 10 levels.

Execute Shell Command

Executes a shell command on the KServer. Runs from the \windows\system32 directory. For example, the shell command dir c:\temp runs the directory command from \windows\systems32 directory but displays the directory for c:\temp. When running a batch file use a cd command at the top of the batch file to change directories and run all subsequent commands from that directory. Separate fields are provided to direct the output of the command line to an output file or to a variable. If the output file exists, it is overwritten.

Fails the Current Ticket Transaction

If included in a procedure, cancels all changes to the ticket. Cancels both ticket changes made manually before saving the ticket and ticket changes made within the procedure being processed prior to this step being run. Does not cancel Send Email or Send Message steps processed before this step is run. Cancels all steps in the procedure after this step is run.

Get a Variable

Defines a new procedure variable and assigns it a value. Specify the variable name without brackets. Example: var_name.

You can refer to this variable in text fields in any subsequent steps by adding [= and =] around the variable name. Example: [=var_name=]. See Procedure Variables and Working with Variables for more information about variables.

  • Constant Value - Enter a value for the variable.

Link to Another Ticket

Links the ticket being processed to a specified ticket ID or knowledge base article ID.

Pause Stage Goal

Pauses counting elapsed time against the current stage goal. Goal procedures are linked to stages using the Service Desk > Definitions > Processing > Stage > Procedures tab.

Pause Ticket Goal

Pauses counting elapsed time against the ticket goal. The ticket goal determines the due date for the entire ticket. Goals are linked to a service desk using the Definitions > Properties > General > Procedures tab.

Resume Stage Goal

Resumes counting elapsed time against the current stage goal. Goal procedures are linked to stages using the Service Desk > Definitions > Processing > Stage > Procedures tab.

Resume Ticket Goal

Resumes counting elapsed time against the ticket goal. The ticket goal determines the due date for the entire ticket. Goals are linked to a service desk using the Definitions > Properties > General > Procedures tab.

Schedule Procedure

Runs a selected agent procedure for a specified machine. Use [$FullMachineName$] to specify the machine name and machine group, assuming a machine is associated with the ticket. Otherwise you can enter a procedure variable for the machine name or specify a fixed machine name value.

Send Email

Sends an email to one or more recipients. Specifies the subject and body text of the email.

You can include object variables, global variables and procedure variables in the To, From, Subject, and Body fields of a Send Email command. You can reference object variables, global variables and procedure variables in the message templates you link to in a Send Email command. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

You can also enter the name of a pool of users. Names are delimited using commas or semi-colons. The following order of precedence determines the email addresses of recipients. The name in the To field of a Send Email step is checked to see if it:

  • Exists as a user name. If that name is found, and an email address exists for that user, then that email address is used.
  • Conforms to an SMTP email address. For example, user@domain.com. If the name matches that pattern, that name is used for the email address. If a service desk pool name conforms to an email address, then email will be sent to that email address, not to the pool of users in that pool.
  • The name is looked up as a service desk pool. The email is sent to the email addresses associated with each user in the pool.

Send Message

Sends a message to the Inbox of a user.

You can only enter one user name in the To field of the Send Message dialog box. Use Send Message to User Pool to send a message to multiple users.

You can include object variables, global variables and procedure variables in the To, From, Subject, and Body fields of a Send Message command. You can reference object variables, global variables and procedure variables in the message templates you link to in a Send Message command. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

Send Message to Pool Users

Sends a message to the Inbox of all users in a selected pool.

You can include object variables, global variables and procedure variables in the Subject, and Body fields of a Send Message to Pool Users command. You can reference object variables, global variables and procedure variables in the message templates you link to in a Send Message to User Pool command. See Message Templates for a list of object variables. See Procedure Variables and Working with Variables for more information about variables.

Set Escalation Time

Sets the time a ticket is escalated. Overrides the default escalation time set for a stage using the Service Desk > Definitions > Processing > Stage > Procedures tab. The escalation time can be calculated using the coverage schedule associated with the ticket or using calendar time. For example, if a coverage schedule does not include weekend coverage, and the ticket escalation procedure runs during the weekend, escalation of the ticket will not start counting until coverage begins on Monday morning. If escalation time is calculated using:

  • Calendar time, and a coverage schedule is associated with the ticket, calendar time is used.
  • A coverage schedule, and no coverage schedule is associated with the ticket, calendar time is used.

Set Goal Time

Sets the time the goal for a stage is scheduled to be completed. Overrides the default goal time set for a stage using the Service Desk > Definitions > Processing > Stage > Procedures tab.

Set Ticket Goal Time

Sets the time the goal for a ticket is scheduled to be completed. The ticket goal determines the due date for the entire ticket. Overrides the default goal time set for a ticket using the Definitions > Properties > General > Procedures tab.

Write Procedure Log Entry

Writes the supplied string to System > Application Logging.