Creating a business rule in ServiceNow for creating information events for trouble tickets


After configuring Proactive Service Resolution for ServiceNow Telecommunications and Media Assurance Workflows, you must create a business rule to be able to create information events in BMC Helix Operations Management. The information events include information about the trouble ticket every time a ticket is created or updated. 

For more information about business rules, see the ServiceNow documentation. 


Before you begin

You must obtain the API access key and tenant ID for your BMC Helix tenant before creating a business rule. 

  1. Log on to BMC Helix Portal and navigate to User access > Users and keys > Access keys. 
  2. If a key is not created for BMC Helix Intelligent Automation, click Add key and type the key name.
  3. Select the key type as Access key and click Confirm.
  4. Click Copy all key details and paste the content in a notepad. 
    You get the access key and the tenant ID for your BMC Helix tenant. 
    For more information, see the To create an access key for user access section in Setting up access keys for programmatic access.

  5. If using an on-premises deployment of ServiceNow, ensure that the ServiceNow connector is configured and running by using the remote plugin in BMC Helix Intelligent Automation. 



To create a business rule in ServiceNow

  1. Log on to your ServiceNow application and navigate to All > System Definition > Business Rules.
  2. Click New.
  3. Enter a name for the rule. 
  1. Select the table depending on the type of ticket that you want to create.
    For a case, select Case. For an incident, select Incident.
  2. Click Advanced and select the following options: 
    1. In the When to run tab, select after to run this rule after any of the selected actions take place.
    2. From the list of actions, select Insert, Update, and Delete.
    3. In the Advanced tab, copy and paste the following script. 
      When you copy the key details from BMC Helix Portal, you get the key details and the tenant ID. Copy the entire key details string to use as the access key in the following script:

      (function executeRule(current, previous /*null when async*/ ) {

          var id = current.getValue('sys_id');
          var label = current.sys_meta.label;

         var request = new sn_ws.RESTMessageV2();
          request.setEndpoint(
             'https://<BMC Helix tenant URL>/intelligent-automation/restplugin/api/v1/client/listener'
          );
          request.setHttpMethod('POST');

          var tenantId = '<tenant_ID>';
          var accessKey = '<access_key>;

          request.setBasicAuth(tenantId, accessKey);
          request.setRequestHeader('
      Accept', '*/*');
          request.setRequestHeader('Content-Type', 'application/json');

                    var body = {};
                    body.ticket_id = id;
                    body.display_id = current.getValue('number');              
                    body.label = label;                              


          request.setRequestBody(JSON.stringify(body));
                   
          var response = request.execute();

      })(current, previous);
    4. In the script, make the following changes: 
      1. For the request.setEndpoint parameter, specify the REST API URL where your BMC Helix Intelligent Automation is available. 

        Note

        If using an on-premises version of ServiceNow, set the request.setEndpoint to https://<hostname:port>/intelligent-automation/remote-restplugin/api/v1/client/listener, where the hostname is the host where the ServiceNow connector (remote plugin) is running, and the port is the value specified for the config.port parameter in the plugin.properties file. 

      2. For the tenantId parameter, specify the BMC Helix tenant ID. 
      3. For the accessKey parameter, specify the access key for your BMC Helix tenant.
  3. Save changes to the business rule. 

Based on the business rule, every time a trouble ticket is created, updated, or deleted in ServiceNow Telecommunications and Media Assurance Workflows, an information event with the appropriate details is created in BMC Helix Operations Management.  


Where to go from here

After successfully configuring ServiceNow, you can directly view the status of the automation policies run by BMC Helix Intelligent Automation for creating trouble tickets. For more information, see Viewing-automation-policy-runs-history

 

Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*