ServiceNow Variable subsitution not working when creating tickets
search cancel

ServiceNow Variable subsitution not working when creating tickets

book

Article ID: 282334

calendar_today

Updated On:

Products

Autosys Workload Automation

Issue/Introduction

When trying to override the template with attributes in the job, this process is not working.
The default in the template is not being replaced.
What is the proper way to set a default value and still have the template work?

The below example is trying to override "assignment_group": "ITS Operations"

Template:

#Indicates that the scheduler sends the request payload to the help desk server for ticket creation or update when the job status is FAILURE.
[FAILURE]
#
#Specifies the data that the scheduler sends in the request payload to the help desk server for the ticket creation.
HELPDESK_TICKET_INPUT_CREATE=[start]
{
    "short_description": "AutoSys Job Name: <<job_name>> Has Failed with Exit Code: <<exit_code>>",
    "description": "Job Name: <<job_name>> \nExit Code: <<exit_code>>\nMachine: <<run_machine>>\nRun Number: <<run_identifier>>\nJob Status: <<job_status>>\nStart Time: <<start_time>>\nEnd Time: <<completion_time>>",
    "impact": "4",
    "category": "Application",
    "subcategory": "Batch Job",
    "assignment_group": "IT Operations",
    "caller_id": "Autosys",
    "location": "Canada-Ontario",
    "contact_type":"Autocut",
    "u_job_name":"<<job_name>>",
    "u_error_code":"<<exit_code>>",
    "u_ci_class":"Business Service "
}
[end]

Job JIL

insert_job: DEV_CMD_HELPDESK_TEST   job_type: CMD 
command: exit 1
machine: localhost
owner: <USERNAME>
permission: 
date_conditions: 0
description: "This is a test job"
alarm_if_fail: 1
alarm_if_terminated: 1
helpdesk: y
helpdesk_template: JobFailureTemplate
helpdesk_attr: assignment_group="IT-Scheduling Services"

Environment

Autosys 12.1SP1 and newer

Resolution

1. Delete the GLOB for the job template:
2. Modify the template:
From:
#Indicates that the scheduler sends the request payload to the help desk server for ticket creation or update when the job status is FAILURE.
[FAILURE]
#
#Specifies the data that the scheduler sends in the request payload to the help desk server for the ticket creation.
HELPDESK_TICKET_INPUT_CREATE=[start]
{
    "short_description": "AutoSys Job Name: <<job_name>> Has Failed with Exit Code: <<exit_code>>",
    "description": "Job Name: <<job_name>> \nExit Code: <<exit_code>>\nMachine: <<run_machine>>\nRun Number: <<run_identifier>>\nJob Status: <<job_status>>\nStart Time: <<start_time>>\nEnd Time: <<completion_time>>",
    "impact": "4",
    "category": "Application",
    "subcategory": "Batch Job",
    "assignment_group": "IT Operations",
    "caller_id": "Autosys",
    "location": "Canada-Ontario",
    "contact_type":"Autocut",
    "u_job_name":"<<job_name>>",
    "u_error_code":"<<exit_code>>",
    "u_ci_class":"Business Service"
}
[end]

To:

#Indicates that the scheduler sends the request payload to the help desk server for ticket creation or update when the job status is FAILURE.
[FAILURE]
#
#Specifies the data that the scheduler sends in the request payload to the help desk server for the ticket creation.
HELPDESK_TICKET_INPUT_CREATE=[start]
{
    "short_description": "AutoSys Job Name: <<job_name>> Has Failed with Exit Code: <<exit_code>>",
    "description": "Job Name: <<job_name>> \nExit Code: <<exit_code>>\nMachine: <<run_machine>>\nRun Number: <<run_identifier>>\nJob Status: <<job_status>>\nStart Time: <<start_time>>\nEnd Time: <<completion_time>>",
    "impact": "4",
    "category": "Application",
    "subcategory": "Batch Job",
    "assignment_group": " <<helpdesk_attr[assignment_group]>>
    "caller_id": "Autosys",
    "location": "Canada-Ontario",
    "contact_type":"Autocut",
    "u_job_name":"<<job_name>>",
    "u_error_code":"<<exit_code>>",
    "u_ci_class":"Business Service"
}
[end]

3. Insert the new Glob
    Note:
    Please make sure you are editing and storing the template in the below location and not in the temp directory:$AUTOSYS/install/helpdesk_templates/


For the substitution to happen the template must have the variable format above in it.
It can not have a hard-coded default value.

Note:
If you want to set a default value for this item, this would be done in the $AUTOUSER/helpdesk.<instance name>  file in the below section:

#+---------
#
# Keyword: helpdesk_attr[key]=<value>
#
# Defines the default and custom data for the request payload.
# The scheduler includes the data when the ticket is created in the help desk server.
#
# Example: helpdesk_attr[caller_id]=System Administrator
#          helpdesk_attr[urgency]=2
#
# Note: multiple help desk attributes can be specified.
#
#
############## User Comments - Start. Keyword: helpdesk_attr[key]  #################
#
#
############## User Comments - End. Keyword: helpdesk_attr[key]  #################

Additional Information