> ## Documentation Index
> Fetch the complete documentation index at: https://docs.occtoo.com/llms.txt
> Use this file to discover all available pages before exploring further.

# previewLifecycle

> Evaluates an unsaved definition on a sample of entries, the first ones by entry id before applicability is checked. Nothing is saved, and every count describes the sample only.



**query** `previewLifecycle(cardDefinitionId: String!, definition: LifecycleDefinitionInput!, sampleSize: Int!): LifecyclePreview`

## Arguments

**`cardDefinitionId`**: `String!` (required)

Raw id of the card definition (e.g. `products`), not the global `CardDefinition.id`.

---

**`definition`**: `LifecycleDefinitionInput!` (required)

Definition to preview. Nothing is saved.

---

**`sampleSize`**: `Int!` = 25

Number of entries to sample, 1 to 100. Default 25.

## Returns

`LifecyclePreview`

**`actualSampleSize`**: `Int!`

The number of entries in this sample, including inapplicable entries.

---

**`definition`**: `LifecycleDefinition!`

The unsaved definition. Its step and rule ids belong to this preview only; use slugs to match input components.

---

**`entries`**: `[LifecyclePreviewEntry!]!`

Sampled entries in entry id order, including inapplicable entries.

---

**`evaluatedAt`**: `DateTime!`

When the indexed read began. This is not a source-data timestamp.

---

**`requestedSampleSize`**: `Int!`

The requested upper bound on sampled entries.

---

**`sampleDistribution`**: `LifecycleSampleDistribution!`

Readiness counts for this sample only, not for every entry of the card definition.

---

**`samplingMethod`**: `LifecycleSamplingMethod!`

How roots were selected before testing applicability. The sample is not random.

## Examples

```graphql Query
query PreviewLifecycle($cardDefinitionId: String!, $definition: LifecycleDefinitionInput!) {
  previewLifecycle(cardDefinitionId: $cardDefinitionId, definition: $definition) {
    actualSampleSize
    definition {
      applicability {
        and {
          __typename
        }
        boolean {
          __typename
        }
        decimal {
          __typename
        }
        hasValue {
          __typename
        }
        integer {
          __typename
        }
        list {
          __typename
        }
      }
      applicabilityJson
      briefing
      name
      steps {
        briefing
        name
        rules {
          __typename
        }
        slug
        stepId
      }
    }
    entries {
      assessment {
        applicable
        firstIncompleteStepId
        state
        steps {
          __typename
        }
      }
      entryId
    }
    evaluatedAt
    requestedSampleSize
    sampleDistribution {
      complete
      incomplete
      notApplicable
    }
  }
}
```

```json Variables
{
  "cardDefinitionId": "string",
  "definition": {
    "name": "string",
    "steps": [
      {
        "name": "string",
        "rules": [
          {
            "assertion": {},
            "message": "string",
            "severity": "ERROR",
            "slug": "string"
          }
        ],
        "slug": "string"
      }
    ]
  }
}
```

```json Response
{
  "data": {
    "previewLifecycle": {
      "actualSampleSize": 1,
      "definition": {
        "applicability": {
          "and": [
            {
              "__typename": "SearchPredicate"
            }
          ],
          "boolean": {
            "__typename": "BooleanPredicate"
          },
          "decimal": {
            "__typename": "DecimalPredicate"
          },
          "hasValue": {
            "__typename": "PropertyReference"
          },
          "integer": {
            "__typename": "IntegerPredicate"
          },
          "list": {
            "__typename": "ListPredicate"
          }
        },
        "applicabilityJson": "value",
        "briefing": "string",
        "name": "string",
        "steps": [
          {
            "briefing": "string",
            "name": "string",
            "rules": [
              {
                "__typename": "LifecycleRule"
              }
            ],
            "slug": "string",
            "stepId": "value"
          }
        ]
      },
      "entries": [
        {
          "assessment": {
            "applicable": true,
            "firstIncompleteStepId": "value",
            "state": "COMPLETE",
            "steps": [
              {
                "__typename": "LifecycleStepAssessment"
              }
            ]
          },
          "entryId": "string"
        }
      ],
      "evaluatedAt": "value",
      "requestedSampleSize": 1,
      "sampleDistribution": {
        "complete": 1,
        "incomplete": 1,
        "notApplicable": 1
      }
    }
  }
}
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.