Remedy On-Demand Deprecated

Deprecated. Use BMC Helix ITSM instead.

Case Management · BMC Remedy On-Demand (Deprecated)

Details

IDRemedy On-Demand
ProviderKKR
CategoryCase Management
From Version5.0.0
Supported ModulesAgentix XSIAM

README

Deprecated. use BMC Helix ITSM instead.

This integration was integrated and tested with version 9.1 of Remedy On-Demand

Configure Remedy On-Demand in Cortex

Parameter Description Required
url Server URL (e.g. ‘https://myurl.com’, ‘http://41.79.151.82’) True
port Port False
credentials Username True
proxy Use system proxy settings False
insecure Trust any certificate (not secure) False
isFetch Fetch incidents False
incidentType Incident type False

Commands

You can execute these commands from the CLI, as part of an automation, or in a playbook.
After you successfully execute a command, a DBot message appears in the War Room with the command details.

remedy-incident-create


Create new ticket incident.



Note: according to Remedy AR API documentation it is recommended to provide all of the non-custom arguments. However, there is no accurate specification, and it is possible to provide other fields using the custom-fields argument alone.

Base Command

remedy-incident-create

Input

Argument Name Description Required
first-name customer’s first name (make sure customer already exists). Required
last-name customer’s first name (make sure customer already exists). Required
description Incident description. Required
status Incident status. Possible values are: New, Assigned, In Progress, Pending, Resolved, Closed, Cancelled. Required
source Incident source. Possible values are: Direct Input, Email, External Escalation, Fax, Self-Service, Systems Management, Phone, Voice Mail, Walk, Web, Other. Required
service-type Incident service-type. Possible values are: User Service Restoration, User Service Request, Infrastructure Event, Infrastructure Restoration. Required
impact Incident impact. Possible values are: 1-Extensive/Widespread, 2-Significant/Large, 3-Moderate/Limited, 4-Minor/Localized. Required
urgency Incident urgency. Possible values are: 1-Critical, 2-High, 3-Medium, 4-Low. Required
custom-fields Custom fields for incident creation. Comma-separated query or custom-fields-seperator separated query. (e.g., field1=value1,field2=value2). Optional
custom-fields-separator A custom delimiter to use for the custom-fields. Don’t use ‘=’ as a delimiter. Default value is ‘,’. Optional

Context Output

Path Type Description
Ticket.ID string Ticket ID
Ticket.Submitter string Ticket submitter
Ticket.Status string Ticket status
Ticket.Description string Ticket description
Ticket.Source string Ticket reported source
Ticket.Impact string TicketiImpact
Ticket.Urgency string Ticket urgency
Ticket.Type string Ticket service type

Command Example

!remedy-incident-create first-name=App last-name=admin description="hola mundo" impact="1-Extensive/Widespread" service-type="User Service Request" source="Direct Input" status=New urgency="3-Medium"

Human Readable Output

Incident created

Client Sensitivity Client Type Company Contact_Company Create Date DatasetId Default City Default Country Description First_Name Impact Incident Number InfrastructureEventType InstanceId Last Modified By Modified Date Person Instance ID Priority Weight ReconciliationIdentity Region Reported Date Reported Source Request ID Description Site Site Group Site ID State Province Status History Street Submitter Time Zone Urgency VIP Zip/Postal Code
Standard Office-Based Employee Calbro Services Calbro Services 2019-02-07T11:42:58.000+0000 0 New York United States hola mundo App 1-Extensive/Widespread INC123 None AGGA5B9BGBHP4APMKA9MPLNHKM0GM4 admin 2019-02-07T11:42:58.000+0000 AG0050560C63F2E1pSRAl5svAA5h4A High 19 0 Americas 2019-02-07T11:42:58.000+0000 Direct Input 000000000000012 User Service Request Headquarters, Building 1.31 United States STE_SOLN0002846 New York New {“New”:{“user”:”admin”,”timestamp”:”2019-02-07T11:42:58.000+0000”}} 1114 Eighth Avenue, 31st Floor admin (GMT-05:00) Eastern Time (US & Canada) 3-Medium No 10036

remedy-get-incident


Get one incident by ID

Base Command

remedy-get-incident

Input

Argument Name Description Required
ID Incident Entry ID. If EntryID is not available to you, incident details can be found using `remedy-fetch-incidents query=”‘Incident Number’ = "<incident number>"”. Required

Context Output

Path Type Description
Ticket.ID string Ticket ID
Ticket.Submitter string Ticket submitter
Ticket.Status string Ticket status
Ticket.Description string Ticket description
Ticket.Source string Ticket reported source
Ticket.Impact string TicketiImpact
Ticket.Urgency string Ticket urgency
Ticket.Type string Ticket service type

Command Example

!remedy-get-incident ID=9

Human Readable Output

Incident

Client Sensitivity Client Type Company Contact_Company Create Date DatasetId Default City Default Country Description First_Name Impact Incident Number InfrastructureEventType InstanceId Last Modified By Modified Date Person Instance ID Priority Weight ReconciliationIdentity Region Reported Date Reported Source Request ID Description Site Site Group Site ID State Province Status History Street Submitter Time Zone Urgency VIP Zip/Postal Code
Standard Office-Based Employee Calbro Services Calbro Services 2019-02-07T11:42:58.000+0000 0 New York United States hola mundo App 1-Extensive/Widespread INC123 None AGGA5B9BGBHP4APMKA9MPLNHKM0GM4 admin 2019-02-07T11:42:58.000+0000 AG0050560C63F2E1pSRAl5svAA5h4A High 19 0 Americas 2019-02-07T11:42:58.000+0000 Direct Input 000000000000012 User Service Request Headquarters, Building 1.31 United States STE_SOLN0002846 New York New {“New”:{“user”:”admin”,”timestamp”:”2019-02-07T11:42:58.000+0000”}} 1114 Eighth Avenue, 31st Floor admin (GMT-05:00) Eastern Time (US & Canada) 3-Medium No 10036

remedy-fetch-incidents


Fetch all incidents

Base Command

remedy-fetch-incidents

Input

Argument Name Description Required
query Search query/qualification format of ‘<field> LIKE “<values>”’ (e.g. ‘Company LIKE “My company”’, ‘Submitter LIKE “%john%”’). Optional
sort Sort query results in descending or ascending order. Format:’<field>.asc’ or ‘<field>.desc’ (e.g. ‘Assigned To.asc’). Optional

Context Output

Path Type Description
Ticket.Assignee string Ticket assignee
Ticket.Description string Ticket description
Ticket.Email string Ticket email
Ticket.EntryID string Ticket entry ID
Ticket.ID string Ticket request ID
Ticket.Impact string Ticket impact
Ticket.IncidentNumber string Ticket number
Ticket.ModifiedDate string Ticket modified date
Ticket.Priority string Ticket priority
Ticket.RequestID string Ticket request ID
Ticket.ServiceType string Ticket service type
Ticket.Source string Ticket reported source
Ticket.Status string Ticket reported status
Ticket.Submitter string Ticket submitter
Ticket.Type string Ticket service type
Ticket.Urgency string Ticket urgency

Command Example

!remedy-fetch-incidents

Human Readable Output

Incidents

Client Sensitivity Client Type Company Contact_Company Create Date DatasetId Default City Default Country Description First_Name Impact Incident Number InfrastructureEventType InstanceId Last Modified By Modified Date Person Instance ID Priority Weight ReconciliationIdentity Region Reported Date Reported Source Request ID Description Site Site Group Site ID State Province Status History Street Submitter Time Zone Urgency VIP Zip/Postal Code
Standard Office-Based Employee Calbro Services Calbro Services 2019-02-07T11:42:58.000+0000 0 New York United States hola mundo App 1-Extensive/Widespread INC123 None AGGA5B9BGBHP4APMKA9MPLNHKM0GM4 admin 2019-02-07T11:42:58.000+0000 AG0050560C63F2E1pSRAl5svAA5h4A High 19 0 Americas 2019-02-07T11:42:58.000+0000 Direct Input 000000000000012 User Service Request Headquarters, Building 1.31 United States STE_SOLN0002846 New York New {“New”:{“user”:”admin”,”timestamp”:”2019-02-07T11:42:58.000+0000”}} 1114 Eighth Avenue, 31st Floor admin (GMT-05:00) Eastern Time (US & Canada) 3-Medium No 10036

remedy-incident-update


Update exiting incident

Base Command

remedy-incident-update

Input

Argument Name Description Required
ID Incident Entry ID. If EntryID is not available to you, incident details can be found using `remedy-fetch-incidents query=”‘Incident Number’ = "<incident number>"”. Required
description Updated description. Optional
status Updated status (unchanged if not specified). Possible values are: New, Assigned, In Progress, Pending, Resolved, Closed, Cancelled. Optional
urgency Updated urgency (unchanged if not specified). Possible values are: 1-Critical, 2-High, 3-Medium, 4-Low. Optional
impact Updated impact (unchanged if not specified). Possible values are: 1-Extensive/Widespread, 2-Signinficant/Large, 3-Moderate/Limited, 4-Minor/Localized. Optional
source Updated reported source (unchanged if not specified). Possible values are: Direct Input, Email, External Escalation, Fax, Self-Service, Systems Management, Phone, Voice Mail, Walk, Web, Other. Optional
service-type Updated service-type (unchanged if not specified). Possible values are: User Service Restoration, User Service Request, Infrastructure Event, Infrastructure Restoration. Optional

Context Output

Path Type Description
Ticket.ID string Ticket ID
Ticket.Submitter string Ticket submitter
Ticket.Status string Ticket status
Ticket.Description string Ticket description
Ticket.Source string Ticket reported source
Ticket.Impact string TicketiImpact
Ticket.Urgency string Ticket urgency
Ticket.Type string Ticket service type

Command Example

!remedy-incident-update ID=9 description="Turns out it wasn't so bad after all!" impact="4-Minor/Localized" urgency="4-Low"

Human Readable Output

Updated incident

Client Sensitivity Client Type Company Contact_Company Create Date DatasetId Default City Default Country Description First_Name Impact Incident Number InfrastructureEventType InstanceId Last Modified By Modified Date Person Instance ID Priority Weight ReconciliationIdentity Region Reported Date Reported Source Request ID Description Site Site Group Site ID State Province Status History Street Submitter Time Zone Urgency VIP Zip/Postal Code
Standard Office-Based Employee Calbro Services Calbro Services 2019-02-07T11:42:58.000+0000 0 New York United States hola mundo App 1-Extensive/Widespread INC123 None AGGA5B9BGBHP4APMKA9MPLNHKM0GM4 admin 2019-02-07T11:42:58.000+0000 AG0050560C63F2E1pSRAl5svAA5h4A High 19 0 Americas 2019-02-07T11:42:58.000+0000 Direct Input 000000000000012 User Service Request Headquarters, Building 1.31 United States STE_SOLN0002846 New York New {“New”:{“user”:”admin”,”timestamp”:”2019-02-07T11:42:58.000+0000”}} 1114 Eighth Avenue, 31st Floor admin (GMT-05:00) Eastern Time (US & Canada) 3-Medium No 10036

Configuration parameters

  • url — Server URL (e.g. 'https://myurl.com', 'http://41.79.151.82') (required)
  • port — Port
  • credentials — Username (required)
  • proxy — Use system proxy settings
  • insecure — Trust any certificate (not secure)
  • isFetch — Fetch incidents
  • incidentType — Incident type
  • incidentFetchInterval — Incidents Fetch Interval

Commands (4)

  • remedy-fetch-incidents

    Fetch all incidents

  • remedy-get-incident

    Get one incident by ID

  • remedy-incident-create

    Create new ticket incident. Note - according to Remedy AR API documentation it is recommended to provide all of the non-custom arguments. However, there is no accurate specification, and it is possible to provide other fields using the custom-fields argument alone.

  • remedy-incident-update

    Update exiting incident

// remove '/' at the end of the url (if exists)
params.url = params.url.replace(/[\/]+$/, '');

var baseUrl = params.url;
if (params.port) {
    baseUrl = baseUrl + ':' + params.port;
}
var insecure = params.insecure;
var proxy = params.proxy;

// returns incId padded with '0's that is 15 length string. e.g. '82' -> '000000000000082'
var preperIncId = function (incId) {
    var res = '000000000000000' + incId;
    return res.substr(-15);
};

var createTableEntry = function (name, contents, context, headers) {
    return {
        // type
        Type: entryTypes.note,
         // contents
        ContentsFormat: formats.json,
        Contents: contents,
        // human-readable
        ReadableContentsFormat: formats.markdown,
        HumanReadable: tableToMarkdown(name, contents, headers),
        // context
        EntryContext: context
    };
};

// mutetor that removes all falsly fields
var filterEmptyFields = function(obj) {
    Object.keys(obj).forEach(function(key) {
        if (obj[key] === undefined || obj[key] === null) {
            delete obj[key];
        }
    });
};

var sendRequest = function(url, token, method, body) {
    var res = http(
        url,
        {
            Method: method || 'GET',
            Headers: {
                'Content-Type': ['application/json'],
                'Authorization': ['AR-JWT ' + token]
            },
            Body: body
        },
        insecure,
        proxy
    );

    if (res.StatusCode < 200 || res.StatusCode >= 300) {
        logout(token);
        throw 'Request Failed'
            + '\nurl: ' + url
            + '\nStatus code: ' + res.StatusCode
            + '\nBody: ' + JSON.stringify(res);
    }

    return res;
};

var login = function() {
    var url = baseUrl + '/api/jwt/login';

    var body = {
        username: params.credentials.identifier,
        password: params.credentials.password
    };

    var res = http(
        url,
        {
            Method: 'POST',
            Headers: {
                'Content-Type': ['application/x-www-form-urlencoded']
            },
            Body: encodeToURLQuery(body).replace(/^\?/, '')
        },
        insecure,
        proxy
    );

    if (!res || res.StatusCode < 200 || res.StatusCode >= 300) {
        throw 'Request Failed'
            + '\nurl: ' + url
            + '\nStatus code: ' + res.StatusCode
            + '.\nBody: ' + JSON.stringify(res, null, 2);
    }

    // retrun the body which is tokenKey
    return res.Body;
};

var logout = function(token) {
    var url = baseUrl + '/api/jwt/logout/';
    sendRequest(url, token, 'POST');
};

var convertIncidentToTicket = function(incident) {
    var incident_filtered = {};
    if (incident['Assigned To']) { incident_filtered.Assignee = incident['Assigned To']; }
    if (incident.Description) { incident_filtered.Description = incident.Description; }
    if (incident['Internet E-mail']) { incident_filtered.Email = incident['Internet E-mail']; }
    if (incident['Entry ID']) { incident_filtered.EntryID = incident['Entry ID']; }
    if (incident.Impact) { incident_filtered.Impact = incident.Impact; }
    if (incident['Incident Number']) { incident_filtered.IncidentNumber = incident['Incident Number']; }
    if (incident['Modified Date']) { incident_filtered.ModifiedDate = incident['Modified Date']; }
    if (incident.Priority) { incident_filtered.Priority = incident.Priority; }
    if (incident['Request ID']) {
        incident_filtered.ID = incident['Request ID'];
        incident_filtered.RequestID = incident['Request ID'];
    }
    if (incident.Service_Type) {
        incident_filtered.ServiceType = incident.Service_Type;
        incident_filtered.Type = incident.Service_Type;
    }
    if (incident['Reported Source']) { incident_filtered.Source = incident['Reported Source']; }
    if (incident.Status) { incident_filtered.Status = incident.Status; }
    if (incident.Submitter) { incident_filtered.Submitter = incident.Submitter; }
    if (incident.Urgency) { incident_filtered.Urgency = incident.Urgency; }
    return incident_filtered;
};

var updateBodyWithCustomFields = function(body, customFields, customFieldsSeparator) {
    if (!customFieldsSeparator){
        customFieldsSeparator = ','
    }
    if (customFields) {
        var customFieldsArr = customFields.split(customFieldsSeparator);
        for (var i = 0; i < customFieldsArr.length; i++) {
            var equalIndex = customFieldsArr[i].indexOf('=');
            var key = customFieldsArr[i].substring(0, equalIndex);
            var value = customFieldsArr[i].substring(equalIndex + 1);
            body.values[key] = value;
        }
    }
    return body;
};

var createIncident = function(updateObject, customFields, customFieldsSeparator) {
    var url = baseUrl + '/api/arsys/v1/entry/HPD:IncidentInterface_Create';
    var token = login();

    filterEmptyFields(updateObject);
    var body = {
       "values" : updateObject
    };
    body.values.z1D_Action = 'CREATE';
    body = updateBodyWithCustomFields(body, customFields, customFieldsSeparator);

    var res = sendRequest(url, token, "POST", JSON.stringify(body));
    // get created incident
    var incidentUrl = res && res.Headers && res.Headers.Location && res.Headers.Location[0];
    res = sendRequest(incidentUrl, token);
    logout(token);
    var incident = JSON.parse(res.Body).values;
    filterEmptyFields(incident);

    var context = {
        Ticket: incident
    };

    return createTableEntry("Incident created:", convertIncidentToTicket(incident), context);
};

var getIncident = function(id, title) {
    var url = baseUrl + '/api/arsys/v1/entry/HPD:IncidentInterface/' + id;
    var token = login();
    var res = sendRequest(url, token);
    logout(token);
    var incident = JSON.parse(res.Body).values;
    filterEmptyFields(incident);

    var context = {
        'Ticket(val.ID && val.ID == obj.ID)': incident
    };
    return createTableEntry(title || "Incident:", convertIncidentToTicket(incident), context);
};

var fetchIncidents = function(args, test_module=false) {
    var url = baseUrl + '/api/arsys/v1/entry/HPD:IncidentInterface/';
    if (args.query) {
        url += '?q=' + encodeURIComponent(args.query);
        if (args.limit && parseInt(args.limit)) {
            url += '&limit=' + args.limit;
        }
        if (args.sort) {
            url += '&sort=' + encodeURIComponent(args.sort);
        }
    }

    if (test_module) {
        url += '?limit=1&q=Submitter="' + params.credentials.identifier + '"';
    }
    var token = login();
    var res = sendRequest(url, token);
    logout(token);
    var body = JSON.parse(res.Body);

    var incidents = body.entries.map(function(b) {return b.values});
    incidents.forEach(filterEmptyFields);
    var context = {
        'Ticket(val.ID && val.ID == obj.ID)': incidents
    };
    return createTableEntry("Incidents:", incidents.map(convertIncidentToTicket), context);
};

var updateIncident = function(incID, updateObject, customFields) {
    var url = baseUrl + '/api/arsys/v1/entry/HPD:IncidentInterface/' + incID + '|' + incID;
    var token = login();

    filterEmptyFields(updateObject);
    var body = {
       "values" : updateObject
    };
    body = updateBodyWithCustomFields(body, customFields);

    sendRequest(url, token, "PUT", JSON.stringify(body));
    return getIncident(incID, 'Updated incident:');
};

var fetchIncidentsToDemisto = function() {
    var lastRun = getLastRun();
    nowDate = new Date();
    var now = nowDate.toISOString();
    if (!lastRun || !lastRun.value) {
        lastRun = {
            value: (new Date(nowDate.getTime() - 10*60*1000)).toISOString()
        };
    }
    logDebug("Last run value before starting to fetch: " + lastRun.value);
    var query =  "'Submit Date'>" + '"' + lastRun.value + '"';
    var url = baseUrl + '/api/arsys/v1/entry/HPD:IncidentInterface/' + '?q=' + encodeURIComponent(query);
    logDebug("This is the URL with the query for fetching the incidents: " + url);
    var token = login();
    var res = sendRequest(url, token);
    logout(token);
    var body = JSON.parse(res.Body);
    var incidents = [];
    Object.keys(body.entries).forEach(function(key) {
        var incident = body.entries[key].values;
        var requestID = body.entries[key].values['Request ID'];
        incidents.push({
            'name': 'Remedy On-Demand incident ' + requestID,
            'labels': [
                {
                    'type': 'Ticket(val.ID && val.ID == obj.ID)',
                    'value': JSON.stringify(convertIncidentToTicket(incident)) // Ticket ID to be pushed to incident context
                }
            ],
            'rawJSON': JSON.stringify(incident)
        });
    });
    now = new Date().toISOString();
    logDebug("Last run is set to: " + now);
    setLastRun({value: now});
    return JSON.stringify(incidents);
};

switch (command) {
    case 'test-module':
        fetchIncidents(args={}, test_module=true);
        return 'ok';
    case 'fetch-incidents':
        return fetchIncidentsToDemisto();
    case 'remedy-incident-create':
        return createIncident(
            {
                'First_Name': args['first-name'],
                'Last_Name': args['last-name'],
                Description: args.description,
                Status: args.status,
                'Reported Source': args.source,
                'Service_Type': args['service-type'],
                Impact: args.impact,
                Urgency: args.urgency
            },
            args['custom-fields'],
            args['custom-fields-separator']
        );
    case 'remedy-get-incident':
        return getIncident(args.ID);
    case 'remedy-fetch-incidents':
        return fetchIncidents(args);
    case 'remedy-incident-update':
        return updateIncident(
            args.ID,
            {
                Description: args.description,
                Status: args.status,
                'Reported Source': args.source,
                'Service_Type': args['service-type'],
                Impact: args.impact,
                Urgency: args.urgency
            },
            args.custom_fields
        );
}