AlmondTill/G3N API

On this page

createTrainingRequirement

mutation · in the family Training requirement

What it does

Write a training rule — a role template must pass a course within so many days of grace, at this pass mark.

Create a TrainingRequirement in the caller's org group (🎓 — THE WIRE); requires the unrestricted capability and the training-manage right. courseKey must be a live play key (VALIDATION naming the courses otherwise); a second non-doomed rule for the same (roleTemplateKey, courseKey) refuses CONFLICT/IDENTITY_TAKEN; the org's rules are capped at 100 (CONFLICT/TRAINING_CAP).

What happens

Creates a record; every person holding such a role sees the requirement and its due date.

Who may call it

Capability area: Training — Courses, tests, certificates and the training rules of your team.

Arguments

NameTypeRequiredNotes
inputNewTrainingRequirementInput NewTrainingRequirementInput!yesNo further notes.

Returns

TrainingRequirement TrainingRequirement! — A TrainingRequirement (🎓 — THE TRAINING PROGRAM, THE WIRE): the owner's rule that people holding a role copied from the canned template roleTemplateKey must hold a VALID TrainingCertificate for the course courseKey — a LIVE play key of the Playbook registry. graceDays (0..365, default 14) = the days after the role grant before the requirement falls due; passMark (1..100, default 80) = the mark a sitting must reach — the STRICTEST rule binding the person for the course wins at an attempt's start. The pair (roleTemplateKey, courseKey) is IMMUTABLE after birth and UNIQUE among the org's non-doomed rules (a duplicate refuses CONFLICT/IDENTITY_TAKEN); at most 100 rules per org (CONFLICT/TRAINING_CAP past it). NOT searchable (no filter roster until the face).

Example request

mutation ExampleCreateTrainingRequirement($input: NewTrainingRequirementInput!) {
  createTrainingRequirement(input: $input) {
    id
    sysId
    type
    caption
    status
    parentId
    rootId
    createdAt
    updatedAt
    revisionNum
    revision
    roleTemplateKey
    courseKey
    graceDays
    passMark
    note
  }
}

Variables:

{
  "input": {
    "caption": "Blue jeans",
    "roleTemplateKey": "<role template key>",
    "courseKey": "<course key>"
  }
}

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

Example response

{
  "data": {
    "createTrainingRequirement": {
      "id": "01900000-0000-7000-8000-37386ae00000",
      "sysId": "TE-EXMP-0000-000F",
      "type": "TrainingRequirement",
      "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",
      "roleTemplateKey": "<role template key>",
      "courseKey": "<course key>",
      "graceDays": 1,
      "passMark": 1,
      "note": "Restock before the weekend."
    }
  },
  "extensions": {
    "at": {
      "callId": "01EXAMPLE-CALL-ID",
      "version": {
        "requested": {
          "name": "genesis",
          "number": 0
        },
        "serviced": {
          "name": "genesis",
          "number": 0
        }
      }
    }
  }
}

Errors this call can answer

Dry run

Add dryRun: true to the request envelope (extensions.at) to rehearse this call: every check runs, the write is rehearsed against the current records and nothing is stored; the answer is the refusal a real call would give, or the record it would create. Every response to a rehearsal carries dryRun: true, so a rehearsed record is never mistaken for a saved one.