• Services
  • Migration Topics
  • Integration
    • Standard ActionHandlers
    • ServiceNow
    • SAP
    • Jira
    • Email
    • CSV
    • Approval
      • Introduction
    • Introduction to ActionHandlers and Connectors
  • Concepts
  • Best Practices
  • Api

Introduction

The AskApprove capability allows decisions to be made by an "Approver" on whether a Task should be completed or not, and allows them to provide extra information into the Task based on a pre-defined template in the KI.

Prerequisits

The Approval Action Handler requires use of an Approval UI Application in HIRO Desktop. For users to gain access to this application they must be part of the Task Approver Team, haasXXXXX_task_approver, for the given instance. Membership of the Team can be provided in Arago ID by an Organizational Admin. The Approval Action Handler uses the SendEmail capabilities.

Example usage

ki
  name: "Approve Sample"
  description: "KI will ask approval"
  version: "1"
on
  ogit/_id
when
  ProcessIssue=="true"
  ogit/_id
do
  eject_issue(message: "Wait for approve", issue_id: ISSUE::ogit/_id)
  LOCAL::model = '{
      "action":"approve",
      "task":"The task needs to be approved (Title)",
      "template":"Abhi test approval (Body)",
      "controls":[
          {
              "approve":{"/approve":"true"},
              "reject":{"/approve":"false"}
          }
      ]
  }'
  exec: LOCAL::RESULT,
  stdout: LOCAL::OUTPUT,
  stderr: LOCAL::ERROR,
  exit: LOCAL::SYSTEMRC = action(
      capability: "AskApprove",
      user_email: "consult@org.com",
      issue_id: ISSUE::ogit/_id,
      question_model: model
      )
  log.info(LOCAL::RESULT)
  log.info(LOCAL::OUTPUT)
  log.error(LOCAL::ERROR)
  log.info(LOCAL::SYSTEMRC)

  delete(ProcessIssue)
  • The capability should be set to AskApprove

  • The user_email is the recipient email address

  • The questions structure is defined in LOCAL::model (see below)

  • Before the Approval Email is sent, the KI should eject_issue. This puts the Task into a WAITING state. The Approval UI will then return the KI to PROCESSING. If the Task is not put into WAITING, the UI will not show the Task.

The Question Structure (JSON obejct):

{
  "action": "<ACTION>",
  "task": "<TASK>",
  "template": "<TEMPLATE>",
  "controls": [ <CONTROL>, <CONTROL>, ...]
}
  • "action": "<ACTION>" The user friendly name of the action the user will perform, ie "Approve".

  • "task": "<TASK>" The user friendly name of the task the user will perform the action on, ie "Add User to Security Group".

  • "template": "<TEMPLATE>" The user friendly description of the task.

  • "controls": [ <CONTROL>, <CONTROL>, …​] The array of questions / inputs the user needs to provide. The controls array can contain one or more <CONTROL> objects.

  • The <CONTROL> object is a single, or block of input questions for the user. These can be: "Approve or Reject", Text Inputs, or Dropdown Options.

  • The "Approve or Reject" object the only required object, and all other inputs will be available only if the user selects "Approve".

Title

Control Objects

Each Control Object specifies which format to ask the question, and what data to save to the AutomationIssue Node.

For "Approve or Reject" or Dropdown Options, the data is defined as a DataObject which will be saved directly into the AutomationIssue if the option is selected by the user. The DataObject’s key is the Attribute Name, and the value is the value to be saved in the graph. The DataObject can be empty, or have one or more Attribute Mappings.

For Text options, the value is the Attribute Name, the user’s input will be saved to.

The Control Object can be used for either the Approval or Rejection flow. By default they are for the Approval flow, but a key for can be specified to allow the Control Object to used in the Rejection flow.

{
  ..., //Control Object Parameters
  "for": "reject"
}

The Control Object can also be either required or optional. By default they are required, but a key required can be specified to allow this to be configurable.

{
  ..., //Control Object Parameters
  "required": false
}

Approve / Reject Option

{
  "approve": { "/attribute": "value1" },
  "reject": { "/attribute": "value2" }
}
  • "approve": Holds the DataObject to be saved on approval.

  • "reject": Holds the DataObject to be saved on rejection.

Approve / Reject Option

Text Input (single)

{
  "text": "/attribute"
}
  • "text": Holds the string Attribute Name, the user’s input will be saved to.

Text Input (single)

Text Input (multiple)

{
  "text": [
    "/attribute1",
    "/attribute2"
  ]
}
  • "text": Holds an array of string Attribute Namea, the user’s inputs will be saved to.

Text Input (multiple)

Text Input with Provided Label (single)

{
  "text": { "Example Label": "/attribute" }
}
  • "text": Holds an object, Label to Attribute Name, the user’s input will be saved to.

Text Input with Provided Label (multiple)

{
  "text": {
    "Example Label 1": "/attribute1",
    "Example Label 2": "/attribute2"
  }
}
  • "text": Holds an object, Label to Attribute Name, the user’s input will be saved to.

Text Input Header and Description

{
  "text": "/attribute",
  "header": "Header Text",
  "desc": "Description Text",
}
  • "header": Optional Header text for this section.

  • "desc": Optional Description text for this section.

Dropdown / Select

{
  "options": {
    "Option1 Name": { "/attribute": "option_1_value" },
    "Option2 Name": { "/attribute": "option_2_value" }
  }
}
  • "options": Holds an object, which contains Key, Dropdown Option Name, to the DataObject to be saved on selection.

  • There can be multiple Key, Value options.

Dropdown / Select (single)

Dropdown / Select Header and Description

{
  "options": {
    "Option1 Name": { "/attribute": "option_1_value" },
    "Option2 Name": { "/attribute": "option_2_value" }
  },
  "header": "Header Text",
  "desc": "Description Text",
}
  • "header": Optional Header text for this section.

  • "desc": Optional Description text for this section.