Create an automation with a ServiceNow web trigger to display the incident number in the message box.

The ServiceNow web trigger monitors the Incidents table of a ServiceNow instance for events. When a new record is added to the Incident table, the trigger initiates the Message Box action to display the incident number.

先决条件

Ensure that the prerequisites mentioned in Prerequisites section are met.

过程

  1. 在左侧窗格中,单击自动化
  2. 单击 创建 > 任务机器人
    创建任务机器人向导已显示。
  3. 名称字段中为机器人输入一个合适的名称。
    默认情况下,所有机器人都存储在 \Bots 文件夹中。
  4. 可选: 您可以在描述字段中为机器人添加描述。
  5. 可选: 您可以使用选择按钮将机器人保存在不同的文件夹中。
  6. 单击创建和编辑
    机器人已创建,并显示编辑任务机器人
  7. Click Triggers > ServiceNow , and then double-click or drag Web trigger to add the web trigger to Triggers section.
  8. Enter the ServiceNow instance URL in the ServiceNow URL field.
  9. Enter incident in Event Type (table) field as this trigger is configured to monitor the Incident table of the ServiceNow instance.
  10. Select When new record is inserted option from the Listen to event drop-down.
  11. 可选: Enter the search filter from the ServiceNow Incident table in Filter criteria (optional) field.
    Right-click on the filters displayed on the Incident table in ServiceNow, and then click Copy query to copy the filter. Paste the copied filter in the Filter criteria field.
  12. 可选: Enter the roles defined in the ServiceNow instance in the Filter criteria by Role (optional).
  13. Click Pick to choose the preconfigured OAuth connection from the Pick an OAuth connection modal.
    Only Control Room managed OAuth connections are supported. See 使用 OAuth 连接 for more information.
  14. Click Create variable to create a record variable to save the trigger response data.
    The trigger response data contains all the information about the event in which the change occurred and is saved in key-value pair format. You can also select an existing record variable from the drop-down list.
  15. Enter ServiceNowTriggerData in the Create variable modal to create a new record variable.
    By default, the Use as input check box is enabled.
  16. Click Actions > Message Box , and then double-click or drag Message Box action to add it to the Actions section.
  17. Configure the Message Box action as per steps mentioned in 使用消息框 action.
    Change the following settings of the Message Box action using the trigger response data:
    1. Enter $ServiceNowTriggerData{triggerType}$ in Enter the message box window title.
      This variable sets the triggerType key from the trigger response data as the window title of the message box.
    2. Enter $ServiceNowTriggerData{number}$ in Enter the message to display.
      This variable sets the number key from the trigger response data as the message that must be displayed in the message box.
  18. Click Save to save the automation.
Click Run > Run with triggers to activate the trigger. The trigger then listens for When new record is inserted event in the Incidents table of the monitored ServiceNow instance. When a new incident with incident number INC0010015 is created, the trigger starts the Message Box action. A message box is displayed with window title as ServiceNow Trigger and message as INC0010015.