Skip to content

Commit

Permalink
fixes #3
Browse files Browse the repository at this point in the history
  • Loading branch information
liorblob committed Jun 5, 2018
1 parent 54cc4d1 commit cb27032
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions Integrations/integration-SecureWorks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,6 @@ script:
return response;
}
function assignTicketCommand(){
var id = args['id'];
var response = assignTicket(id,
Expand Down Expand Up @@ -584,6 +583,8 @@ script:
{to: 'Closed', from: 'dateClosed'},
{to: 'Priority', from: 'priority'},
{to: 'Reference', from: 'externalTicketNum'},
{to: 'Location', from: 'clientLocation.name'},
{to: 'Categorization', from: 'categorizationClass'},
{to: 'Device', from: 'devices.name'},
{to: 'Assigned Employee', from: 'contact.name'},
{to: 'Watchers', from: 'watchers'},
Expand Down Expand Up @@ -763,6 +764,13 @@ script:
return response;
}
function markTicket(ticketId){
var updateBody = {};
updateBody[DIRTY_FIELD] = DIRTY_VALUE;
sendRequest('tickets/' + ticketId, 'POST', '', updateBody);
}
function fetchIncidents(){
var queryParams = {};
if(params.ticketType){
Expand All @@ -786,16 +794,20 @@ script:
ticketVersions: []
};
var responseTickets = getTicketsUpdates(queryParams);
var responseTickets = getTicketsUpdates(false,
queryParams.limit,
queryParams.ticketType,
queryParams.worklogs,
queryParams.groupingType);
responseTickets.forEach(function(responseTicket){
// Exclude health tickets
var excludeHealthFilter = responseTicket.eventSource !== EVENT_SOURCE_HEALTH_TYPE &&
responseTicket.categorizationClass !== CATEGORIZATION_CLASS_HEALTH_TYPE;
// Exclude tickets that were marked using the designated field
var excludeMarkedTickets = responseTicket[DIRTY_FIELD] !== DIRTY_VALUE;
if(statuses.indexOf(responseTicket.status) !== -1
&& excludeHealthFilter && excludeMarkedTickets){
if(statuses.indexOf(responseTicket.status) !== -1 && excludeHealthFilter && excludeMarkedTickets){
convertTicketDates(responseTicket);
tickets.push(responseTicket);
ticketVersionsObject.ticketVersions.push({
Expand All @@ -804,9 +816,7 @@ script:
});
// Mark the designated field, so it's excluded next time
var updateBody = {};
updateBody[DIRTY_FIELD] = DIRTY_VALUE;
updateTicket(responseTicket.ticketId, updateBody);
markTicket(responseTicket.ticketId);
}
});
Expand Down

0 comments on commit cb27032

Please sign in to comment.