---
schema_version: "1"
id: de55737c3c1ff3509e818bafc63d0176e611cc611d568ba4630ebfbdebacea15
title: CdpCalculatedInsight Class
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: c65e10c3e31d9e7272be93124a9fd3c8f3ce8066d1c169133a1d18e596f7bf94
description: Create, delete, get, run, and update Data 360 calculated insights.These methods are for CdpCalculatedInsight. All methods are static.Create a calculated insight.Delete a calculated insight.Get a calculated insight.Get calculated insights.Get a page of calculated insights.Run a calculated insight.Update a calculated insight.
---
# CdpCalculatedInsight Class

Create, delete, get, run, and update Data 360 calculated insights.

## Namespace

[ConnectApi](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_classes_connect_api.htm "The ConnectApi namespace (also called Connect in Apex) provides classes for accessing the same data available in Connect REST API. Use Connect in Apex to create custom experiences in Salesforce.")

## CdpCalculatedInsight Methods

These methods are for CdpCalculatedInsight. All methods are static.

- **[createCalculatedInsight(input)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_createCalculatedInsight_2)**  
    Create a calculated insight.
- **[deleteCalculatedInsight(apiName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_deleteCalculatedInsight_1)**  
    Delete a calculated insight.
- **[getCalculatedInsight(apiName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_getCalculatedInsight_2)**  
    Get a calculated insight.
- **[getCalculatedInsights(definitionType, batchSize, offset, orderby, dataspace)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_getCalculatedInsights_1)**  
    Get calculated insights.
- **[getCalculatedInsights(definitionType, batchSize, offset, orderby, dataspace, pageToken)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_getCalculatedInsights_2)**  
    Get a page of calculated insights.
- **[runCalculatedInsight(apiName)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_runCalculatedInsight_1)**  
    Run a calculated insight.
- **[updateCalculatedInsight(apiName, input)](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_ConnectAPI_CdpCalculatedInsight_static_methods.htm#apex_ConnectAPI_CdpCalculatedInsight_updateCalculatedInsight_3)**  
    Update a calculated insight.

### createCalculatedInsight(input)

Create a calculated insight.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightOutput createCalculatedInsight(ConnectApi.CdpCalculatedInsightInput input)

#### Parameters

input

Type: [ConnectApi.CdpCalculatedInsightInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_cdp_calculated_insight.htm "Input representation for a calculated insight.")

Input representation for a calculated insight.

shouldCommitTransaction

Type: Boolean

Indicates whether to commit the transaction (true) or not (false).

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightOutput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight.htm "Calculated insight.")

### deleteCalculatedInsight(apiName)

Delete a calculated insight.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static Void deleteCalculatedInsight(String apiName)

#### Parameters

apiName

Type: String

API name of the calculated insight to delete.

shouldCommitTransaction

Type: Boolean

Indicates whether to commit the transaction (true) or not (false).

#### Return Value

Type: Void

### getCalculatedInsight(apiName)

Get a calculated insight.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightOutput getCalculatedInsight(String apiName)

#### Parameters

apiName

Type: String

API name of the calculated insight to get.

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightOutput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight.htm "Calculated insight.")

### getCalculatedInsights(definitionType, batchSize, offset, orderby, dataspace)

Get calculated insights.

#### API Version

56.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightPage getCalculatedInsights(String definitionType, Integer batchSize, Integer offset, String orderby, String dataspace)

#### Parameters

**definitionType**

Type: String

Definition type of the calculated insight. Values are:

- CALCULATED\_METRIC
- CALCULATED\_METRIC
- CALCULATED\_METRIC

**batchSize**

Type: Integer

Number of items to return. Values are from 1–200. If unspecified, the default value is 25.

**offset**

Type: Integer

Number of rows to skip before returning results. If unspecified, no rows are skipped.

**orderby**

Type: String

Sort order for the result set, such as GenderId\_\_c ASC,​Occupation\_\_c DESC. If unspecified, items are returned in the order they are retrieved.

**dataspace**

Type: String

Name of the data space.

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight_collection.htm "Collection of calculated insights.")

### getCalculatedInsights(definitionType, batchSize, offset, orderby, dataspace, pageToken)

Get a page of calculated insights.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightPage getCalculatedInsights(String definitionType, Integer batchSize, Integer offset, String orderby, String dataspace, String pageToken)

#### Parameters

**definitionType**

Type: String

Definition type of the calculated insight. Values are:

- CALCULATED\_METRIC
- CALCULATED\_METRIC
- CALCULATED\_METRIC

**batchSize**

Type: Integer

Number of items to return. Values are from 1–200. If unspecified, the default value is 25.

**offset**

Type: Integer

Number of rows to skip before returning results. If unspecified, no rows are skipped.

**orderby**

Type: String

Sort order for the result set, such as GenderId\_\_c ASC,​Occupation\_\_c DESC. If unspecified, items are returned in the order they are retrieved.

**dataspace**

Type: String

Name of the data space.

**pageToken**

Type: String

Specifies the page token to use to view a page of information. Page tokens are returned as part of the response class, such as currentPageToken or nextPageToken. If you pass in null, the first page is returned.

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightPage](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight_collection.htm "Collection of calculated insights.")

### runCalculatedInsight(apiName)

Run a calculated insight.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightStandardActionesponseRepresentation runCalculatedInsight(String apiName)

#### Parameters

apiName

Type: String

API name of the calculated insight to run.

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightStandardActionResponseRepresentation](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight_action_run_response.htm "Response of the calculated insight run action.")

### updateCalculatedInsight(apiName, input)

Update a calculated insight.

#### API Version

57.0

#### Requires Chatter

No

#### Signature

public static ConnectApi.CdpCalculatedInsightOutput updateCalculatedInsight(String apiName, ConnectApi.CdpCalculatedInsightInput input)

#### Parameters

apiName

Type: String

API name of the calculated insight to update.

input

Type: [ConnectApi.CdpCalculatedInsightInput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_input_cdp_calculated_insight.htm "Input representation for a calculated insight.")

Input representation for a calculated insight.

shouldCommitTransaction

Type: Boolean

Indicates whether to commit the transaction (true) or not (false).

#### Return Value

Type: [ConnectApi.CdpCalculatedInsightOutput](https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_connectapi_output_cdp_calculated_insight.htm "Calculated insight.")