On This Page
Custom Placeholder Objects
Custom placeholder ticket definitions must contain a ticket object. This topic presents the attributes and functions for this object.
Examples
The following examples use the ticket object.
This example returns the date in UTC format:
def ticket_utc(ticket, **kwargs):
#example:'2021-01-22T22:40:23.054-04:00'
format = '%Y-%m-%dT%H:%M:%S.%f%z'
dt_string = ticket.create_date
dt = datetime.strptime(dt_string,format)
return datetime.strftime(dt.astimezone(UTC),'%Y-%m-%d %H:%M:%S')
This example returns the step ID:
def current_step_id(ticket, **kwargs):
try:
step = ticket.get_current_step()
return step.id
except Exception:
return ''
Besides using the ticket object, you can import standard python modules if you want to use them; however, this is not required. For example:
Ticket Object
Attributes
Attribute |
Description |
Type |
Possible Values |
---|---|---|---|
id | SecureChange ticket ID. |
Integer |
|
subject | Subject of the ticket. |
String |
|
requester | Name of the requester. |
String |
|
requester_id | Ticket requester ID. |
Integer |
|
priority | Priority of the request. |
String |
|
status | Status of the ticket. |
String |
|
domain_name | Ticket domain name. |
String |
|
sla_status | Ticket's current SLA status. |
String |
|
sla_outcome |
Outcome of the SLA. |
String |
|
workflow |
Workflow used for this ticket. |
String |
|
step_list |
List of step objects. |
|
|
current_step |
Current step in workflow. |
String |
|
comments |
Comments in the ticket. |
String |
|
create_date |
Ticket creation date. |
String |
|
update_date |
Last update date for the ticket. |
String |
|
Functions
Function |
Description |
Possible Values |
---|---|---|
|
Gets all comments in the ticket |
|
|
Gets the current step in the ticket as an object. If the ticket is not in progress, returns an error. |
|
|
Returns ticket step object by step name from the steps in the ticket that have been processed already. |
|
|
Returns a step object from the ticket based on the step ID. |
|
|
Returns a step object according to the step index. |
|
|
Returns a step object from the last step in the ticket. |
|
|
Returns a step object from the first step in the ticket. |
|
|
Returns a task object in the ticket. |
|
|
Indicates whether the ticket is closed. |
|
|
Indicates whether the ticket is canceled. |
|
|
Indicates whether the ticket is rejected. |
|
|
Indicates whether if the ticket is resolved. |
|
|
Indicates whether if the ticket is in progress. |
|
Step Object
Actions
Attribute |
Description |
Type |
Possible Values |
---|---|---|---|
id | Step ID | Integer |
|
name | Step name | String |
|
redone | Indicates whether the task was redone. | Boolean |
|
skipped | Indicates whether the task was skipped. | Boolean |
|
task_list |
List of task objects. |
|
Functions
Function |
Description |
Possible Values |
---|---|---|
get_task get_last_task()
|
Returns the last task in the step. |
|
is_skipped()
|
Indicates whether the task is skipped. |
|
Task Object
Actions
Attribute |
Description |
Type |
Possible Values |
---|---|---|---|
assignee_id | ID of individual assigned the task. | Integer |
|
assignee | Name of the individual assigned the task. | String |
|
field_list | List of field objects. | Field object |
|
ID | Task ID. | Integer |
|
status |
Status of the task. |
String |
|
Functions
Function |
Description |
---|---|
get_field_list_by_type(field_type)
|
Returns list of field objects. Supported field types in SecureChange include:
|
Field Object
Actions
Attribute |
Description |
Type |
Possible Values |
---|---|---|---|
@xsi.type | Field type | String |
|
id | Field ID | Integer |
|
name | Field name | String |
|
read_only | Indicates whether the field is read-only |
Boolean |
|
Functions
Function |
Description |
---|---|
field_type()
|
Returns the field type. |
get_field_value()
|
Returns the value of the field. |
get_access_requests()
|
Returns list of access requests. |