Skip to main content

ITicketApprovalAutoAction

You can define custom actions by implementing the ITicketApprovalAutoAction interface in application scripts. Automatic actions are only called for manually triggered approvals with automatic status transition disabled. In the newly created script, set the value of the Name property (the name of the automatic action) in the action class constructor.

tip

To store properties and action settings, we recommend defining the Settings class in a separate script that you create from the Class Library template.

warning

If you want to use only some of the methods of the implemented interface in the automatic action, leave an exception in the body of the other methods from the interface:

throw new NotImplementedException();

Interface methods

MethodDescription
OnApprovedApproval of the ticket.
OnRejectedReject ticket.
OnApproverAddedAdding an approver to the approval.
OnApproverCanceledCancellation of a specific approver.

OnApproved

Custom action based on ticket approval. In the implemented method, define both the conditions for executing the operations and the operations themselves.

  • Syntax: void OnApproved(SqlConnection con, SqlTransaction trans, int ticketId, int approvalItemId)
  • Parameters:
    • con - SqlConnection to the database.
    • trans - SqlTransaction of the ongoing database transaction.
    • ticketId - Ticket ID (tHdTicket.iHdTicketId).
    • approvalItemId - approval step ID (tHdTicketApprovalItem.iHdTicketApprovalItemId).
  • Return value: none.

For an example use case, see the OrderAfterApproval application template.

OnRejected

Custom action based on the approval of the ticket rejection. In the implemented method, define both the conditions for executing the operations and the operations themselves.

  • Syntax: void OnRejected(SqlConnection con, SqlTransaction trans, int ticketId, int approvalItemId)
  • Parameters:
    • con - SqlConnection to the database.
    • trans - SqlTransaction of the ongoing database transaction.
    • ticketId - Ticket ID (tHdTicket.iHdTicketId).
    • approvalItemId - approval step ID (tHdTicketApprovalItem.iHdTicketApprovalItemId).
  • Return value: none.

OnApproverAdded

Custom action based on adding a ticket approver. In the implemented method, define both the conditions for executing the operations and the operations themselves.

  • Syntax: void OnApproverAdded(SqlConnection con, SqlTransaction trans, int ticketId, IEnumerable<int> approvalItemIds)
  • Parameters:
    • con - SqlConnection to the database.
    • trans - SqlTransaction of the ongoing database transaction.
    • ticketId - Ticket ID (tHdTicket.iHdTicketId).
    • approvalItemIds - List of approval step IDs (tHdTicketApprovalItem.iHdTicketApprovalItemId).
  • Return value: none.

OnApproverCanceled

Custom action based on the removal of the ticket approver. In the implemented method, define both the conditions for executing the operations and the operations themselves.

  • Syntax: void OnApproverCanceled(SqlConnection con, SqlTransaction trans, int ticketId, IEnumerable<int> approvalItemIds)
  • Parameters:
    • con - SqlConnection to the database.
    • trans - SqlTransaction of the ongoing database transaction.
    • ticketId - Ticket ID (tHdTicket.iHdTicketId).
    • approvalItemIds - List of approval step IDs (tHdTicketApprovalItem.iHdTicketApprovalItemId).
  • Return value: none.