Quality Examples

To ensure data accuracy in non-conformance workflows, follow these example rules. These guidelines emphasize capturing data before proceeding to subsequent steps.

Issue Must Have an Assignee Before Being Submitted for Review
mutation {
  createRule(input: {
    title: "Issue Must Have an Assignee Before Being Submitted for Review.",
    target: ISSUEAPPROVALREQUEST,
    ruleType: VALIDATION,
    eventType: CREATE,
    enabled: true,
    context: "{\n  issueApprovalRequest(id: $id) {\n    id\n    issue {\n      status\n      assignedTo {\n        id\n      }\n    }\n  }\n}",
    code: "issue_approval_request = context.get('issueApprovalRequest') or {}\nissue = issue_approval_request.get('issue') or {}\nstatus = issue.get('status')\nassigned_to = issue.get('assignedTo')\n\nif status in ['PENDING', 'IN_PROGRESS'] and assigned_to is None:\n    raise ValidationError()\n",
    errorState: BLOCK
  }) {
    rule {
      id
    }
  }
}
Cause Condition, Expected Condition, and Disposition text must be populated before moving through review.
mutation {
  createRule(input: {
    title: "All Issue Text Fields Must Be Filled In Before Requesting Reviews",
    target: ISSUEAPPROVALREQUEST,
    ruleType: VALIDATION,
    eventType: CREATE,
    enabled: true,
    context: "{\n  issueApprovalRequest(id: $id) {\n    id\n    issue {\n      status\n      causeCondition\n      expectedCondition\n      disposition\n    }\n  }\n}",
    code: "def has_text(node):\n    return bool(\n      node.get('text')\n      or any(has_text(child) for child in node.get('children') or [])\n    )\n\nissue_approval_request = context.get('issueApprovalRequest') or {}\nissue = issue_approval_request.get('issue') or {}\nis_status_ok = issue.get('status') in ['PENDING', 'IN_PROGRESS']\n\nif is_status_ok:\n  disposition = issue.get('disposition', [])\n  expected_condition = issue.get('expectedCondition', [])\n  cause_condition = issue.get('causeCondition', [])\n  \n  if (\n    not disposition\n    or not expected_condition\n    or not cause_condition\n    or not any(has_text(d) for d in disposition)\n    or not any(has_text(d) for d in expected_condition)\n    or not any(has_text(d) for d in cause_condition)\n  ):\n    raise ValidationError()\n",
    errorState: BLOCK
  }) {
    rule {
      id
    }
  }
}

Last updated

Was this helpful?