# Set a policy value — thresholds and limits

Schedule a policy value for an organization or a location — a fraud-alert threshold, for instance — and see exactly which value applies right now.

Compliance · a play in 2 steps.

## The steps

1. Schedule the value — it takes effect on its start instant. — [createPolicyValueRecord](/reference/policy-value-record/createPolicyValueRecord/)
2. See the value that applies right now — the location’s, else the organization’s, else the platform default. — [resolvePolicyValue](/reference/operating-policy/resolvePolicyValue/)

## The calls

Every operation this use case runs, in the order it first appears, with the request and the response its reference page shows.

### createPolicyValueRecord

[createPolicyValueRecord](/reference/policy-value-record/createPolicyValueRecord/) — mutation · Schedule a policy value for an organization or a location — e.g. a fraud-alert threshold.

**Example request**

```graphql
mutation ExampleCreatePolicyValueRecord($input: NewPolicyValueRecordInput!) {
  createPolicyValueRecord(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    level
    key
    valueInt
    startAt
    endAt
  }
}
```

Variables:

```json
{
  "input": {
    "caption": "Blue jeans",
    "key": "<key>",
    "valueInt": 1,
    "endAt": "2027-01-31T00:00:00.000Z"
  }
}
```

Send it with the envelope naming the version: `"extensions": {"at": {"version": {"name":"genesis","number":0}}}`.

**Example response**

```json
{
  "data": {
    "createPolicyValueRecord": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "PC-EXMP-0000-000F",
      "type": "PolicyValueRecord",
      "caption": "Blue jeans",
      "status": "active",
      "parentId": "01900000-0000-7000-8000-065235280000",
      "rootId": "01900000-0000-7000-8000-a093dd800000",
      "createdAt": "2027-01-31T00:00:00.000Z",
      "updatedAt": "2027-01-31T00:00:00.000Z",
      "revisionNum": 1,
      "revision": "01900000-0000-7000-8000-b7960e180000",
      "level": "<level>",
      "key": "<key>",
      "valueInt": 1,
      "startAt": "2027-01-31T00:00:00.000Z",
      "endAt": "2027-01-31T00:00:00.000Z"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```

### resolvePolicyValue

[resolvePolicyValue](/reference/operating-policy/resolvePolicyValue/) — query · What policy value applies right now (or at a chosen moment) for a location or organization.

**Example request**

```graphql
query ExampleResolvePolicyValue($key: String!, $organizationId: ID!, $logicalFacilityId: ID) {
  resolvePolicyValue(key: $key, organizationId: $organizationId, logicalFacilityId: $logicalFacilityId) {
    key
    valueInt
    source
    recordId
    level
    startAt
    endAt
  }
}
```

Variables:

```json
{
  "key": "<key>",
  "organizationId": "01900000-0000-7000-8000-44b781470000",
  "logicalFacilityId": "01900000-0000-7000-8000-8026f71c0000"
}
```

**Example response**

```json
{
  "data": {
    "resolvePolicyValue": {
      "key": "<key>",
      "valueInt": 1,
      "source": "<source>",
      "recordId": "01900000-0000-7000-8000-ea0d77e10000",
      "level": "<level>",
      "startAt": "2027-01-31T00:00:00.000Z",
      "endAt": "2027-01-31T00:00:00.000Z"
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": null,
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}
```
