diff --git a/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts b/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
index aa8d248566d9a..5f2f5ee019a5f 100644
--- a/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
+++ b/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.test.ts
@@ -1232,6 +1232,23 @@ describe('ServiceNow service', () => {
`);
});
+ test('it should return null if no incident found, when incident to be closed is null', async () => {
+ requestMock.mockImplementationOnce(() => ({
+ data: {
+ result: [],
+ },
+ }));
+
+ const res = await service.closeIncident({ incidentId: '2', correlationId: null });
+ expect(logger.warn.mock.calls[0]).toMatchInlineSnapshot(`
+ Array [
+ "[ServiceNow][CloseIncident] No incident found with correlation_id: null or incidentId: 2.",
+ ]
+ `);
+
+ expect(res).toBeNull();
+ });
+
test('it should return null if found incident with correlation id is null', async () => {
requestMock.mockImplementationOnce(() => ({
data: {
diff --git a/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts b/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
index 84a8592aaa832..4cfe1ad56cfa7 100644
--- a/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
+++ b/x-pack/plugins/stack_connectors/server/connector_types/lib/servicenow/service.ts
@@ -8,6 +8,7 @@
import { AxiosResponse } from 'axios';
import { request } from '@kbn/actions-plugin/server/lib/axios_utils';
+import { isEmpty } from 'lodash';
import {
ExternalService,
ExternalServiceParamsCreate,
@@ -306,7 +307,7 @@ export const createExternalService: ServiceFactory = ({
incidentToBeClosed = await getIncidentByCorrelationId(correlationId);
}
- if (incidentToBeClosed === null) {
+ if (incidentToBeClosed === null || isEmpty(incidentToBeClosed)) {
logger.warn(
`[ServiceNow][CloseIncident] No incident found with correlation_id: ${correlationId} or incidentId: ${incidentId}.`
);
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx
index 1ff0d9f679a05..6ad74732844c0 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/index.test.tsx
@@ -143,7 +143,7 @@ describe('EditConnectorFlyout', () => {
});
await waitFor(() => {
- expect(queryByText('This connector is readonly.')).not.toBeInTheDocument();
+ expect(queryByText('This connector is read-only.')).not.toBeInTheDocument();
expect(getByTestId('nameInput')).toHaveValue('My test');
expect(getByTestId('test-connector-text-field')).toHaveValue('My text field');
});
@@ -176,7 +176,7 @@ describe('EditConnectorFlyout', () => {
/>
);
- expect(getByText('This connector is readonly.')).toBeInTheDocument();
+ expect(getByText('This connector is read-only.')).toBeInTheDocument();
});
it('shows the buttons', async () => {
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.test.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.test.tsx
index baa8eed5265d5..194a3bf1f1524 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.test.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.test.tsx
@@ -25,7 +25,7 @@ describe('ReadOnlyConnectorMessage', () => {
{ wrapper: I18nProvider }
);
- expect(getByText('This connector is readonly.')).toBeInTheDocument();
+ expect(getByText('This connector is read-only.')).toBeInTheDocument();
expect(getByTestId('read-only-link')).toHaveProperty('href', 'https://example.com/');
expect(queryByText('Extra Component')).toBeNull();
});
diff --git a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.tsx b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.tsx
index f32bc2a34bd6b..354f832090869 100644
--- a/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.tsx
+++ b/x-pack/plugins/triggers_actions_ui/public/application/sections/action_connector_form/edit_connector_flyout/read_only.tsx
@@ -22,7 +22,7 @@ export const ReadOnlyConnectorMessage: React.FC<{
<>
{i18n.translate('xpack.triggersActionsUI.sections.editConnectorForm.descriptionText', {
- defaultMessage: 'This connector is readonly.',
+ defaultMessage: 'This connector is read-only.',
})}