• /
  • EnglishEspañolFrançais日本語한국어Português
  • Se connecterDémarrer

New Relic Lens actions

|View as Markdown (English)

This page provides a reference for New Relic Lens actions available in the workflow automation actions catalog. These actions let you run ANSI SQL queries against data sources connected through New Relic Lens directly from a workflow step.

Prerequisites

Before using New Relic Lens actions in workflow automation, ensure you have:

  • A New Relic account with appropriate permissions.
  • One or more data sources connected in New Relic Lens.
  • The necessary permissions for the New Relic Lens service.

Query Lens

The action identifier is newrelic.lens.query.

Runs an ANSI SQL query against connected data sources through New Relic Lens.

The following table describes all available input fields for this action.

Input

Type

Description

Example

query

String

Required. The ANSI SQL statement to execute via Lens. Supports cross-source joins across connected data sources.

accountIds

List of int

Optional. The target accounts for query execution. If you don't provide this field, the query runs against the workflow's execution account.

format

Enum

Optional. The output format for results. Accepts JSON, CSV, PSV, or TSV. Defaults to JSON.

selectors

List

Optional. The selectors to get only the specified parameters as output.

steps:
- name: queryLens
type: action
action: newrelic.lens.query
version: 1
inputs:
accountIds: [12345]
query: >
SELECT appName,appId, count(*) as count FROM telemetry.Transaction
GROUP BY appName, appId LIMIT 1
selectors:
- name: resultsAsString
expression: '.results | tostring'

The following table describes all output fields returned by this action.

Output

Type

Description

results

List

An array of objects containing the results of the query. See Expressions property for more information.

success

Boolean

Returns true if the action succeeded, false otherwise.

errorMessage

String

Contains the failure reason if the action fails. Example:

{
"success": true,
"results": [
{
"appName": "workflow-service (production.us-exit-speed)",
"appId": 2882375598,
"count": 52688
}
]
}
Droits d'auteur © 2026 New Relic Inc.

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.