diff --git a/x-pack/legacy/plugins/siem/public/lib/connectors/servicenow.tsx b/x-pack/legacy/plugins/siem/public/lib/connectors/servicenow.tsx index 365d3ca9ef5e6..a2733322acdf5 100644 --- a/x-pack/legacy/plugins/siem/public/lib/connectors/servicenow.tsx +++ b/x-pack/legacy/plugins/siem/public/lib/connectors/servicenow.tsx @@ -10,6 +10,7 @@ import { EuiFlexItem, EuiFormRow, EuiFieldPassword, + EuiRadioGroup, } from '@elastic/eui'; import { ActionConnectorFieldsProps, @@ -81,13 +82,53 @@ export function getActionType(): ActionTypeModel { const ServiceNowConnectorFields: React.FunctionComponent> = ({ action, editActionConfig, editActionSecrets, errors }) => { - const { apiUrl } = action.config; + const { apiUrl, casesConfiguration } = action.config; const { username, password } = action.secrets; + const closure = casesConfiguration?.closure ?? 'manual'; + const isApiUrlInvalid: boolean = errors.apiUrl.length > 0 && apiUrl !== undefined; const isUsernameInvalid: boolean = errors.username.length > 0 && username !== undefined; const isPasswordInvalid: boolean = errors.password.length > 0 && password !== undefined; + if (!casesConfiguration) { + editActionConfig('casesConfiguration', { + closure: 'manual', + mapping: [ + { + source: 'title', + target: 'description', + onEditAndUpdate: 'nothing', + }, + { + source: 'description', + target: 'short_description', + onEditAndUpdate: 'nothing', + }, + { + source: 'comments', + target: 'work_notes', + onEditAndUpdate: 'nothing', + }, + ], + }); + } + + const radios = [ + { + id: 'manual', + label: 'Manually close SIEM cases', + }, + { + id: 'newIncident', + label: 'Automatically close SIEM cases when pushing new incident to third-party', + }, + { + id: 'closedIncident', + label: 'Automatically close SIEM cases when incident is closed in third-party', + }, + ]; + return ( <> @@ -105,7 +146,7 @@ const ServiceNowConnectorFields: React.FunctionComponent { editActionConfig('apiUrl', e.target.value); }} @@ -172,6 +213,20 @@ const ServiceNowConnectorFields: React.FunctionComponent + + + + { + editActionConfig('casesConfiguration', { ...casesConfiguration, closure: val }); + }} + name="closure" + /> + + + ); }; diff --git a/x-pack/legacy/plugins/siem/public/lib/connectors/types.ts b/x-pack/legacy/plugins/siem/public/lib/connectors/types.ts index 27dfede8d0e41..a8f5e47e05d72 100644 --- a/x-pack/legacy/plugins/siem/public/lib/connectors/types.ts +++ b/x-pack/legacy/plugins/siem/public/lib/connectors/types.ts @@ -6,6 +6,9 @@ interface ServiceNowConfig { apiUrl: string; + casesConfiguration: { + closure: string; + }; } interface ServiceNowSecrets {