# ION Actions examples for Quality

### **Open Redlines Prevent Moving Issue Into In Review**

<pre class="language-json"><code class="lang-json">{ 
<strong>  "create_rule": {
</strong><strong>    "title": "Open Redlines Prevent Moving Issue into In Review",
</strong>    "target": "ISSUE",
    "enabled": true,
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "code": "if context.get('issue', {}).get('status') in ['IN_REVIEW'] and context.get('issue', {}).get('redlines') is not None and not all(redline.get('step', {}).get('status', {}) in ['COMPLETE', 'CANCELED'] for redline in context.get('issue', {}).get('redlines')): raise ValidationError()",
    "context": "{ issue(id: $id) { title status redlines { id step { status } } } }",
    "errorState": "BLOCK"
  }
}
</code></pre>

### No Permission To Reopen A Closed Issue

<pre class="language-json"><code class="lang-json">{
<strong>  "create_rule": {
</strong>    "title": "No Permissions to Control Reopening Issues (Need Quality Engineer, Quality Inspector, Reliability Engineer)",
    "target": "ISSUE",
    "enabled": true,
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "code": "if context.get('issue', {}).get('status', {}) in ['IN_REVIEW'] and context.get('changes', {}).get('issues', {}).get('status', {}).get('old', '') in ['resolved'] and not set(context.get('currentUser', {}).get('roles', {})).intersection(set(['Quality Engineer', 'Quality Inspector', 'Reliability Engineer', 'admin'])): raise ValidationError()",
    "context": "{ issue(id: $id) { title status } }",
    "errorState": "BLOCK"
  }
}
</code></pre>

### Issues Cannot be Closed with an Interim Dispositions

```graphql
{
  "create_rule": {
     "title": "Prevent Issue Tickets with Interim Disposition to transition from 'In Progress' to 'In Review'",
     "target": "ISSUE",
     "enabled": true,
     "eventType": "UPDATE",
     "ruleType": "VALIDATION",
     "code": "if context.get('issue', {}).get('status', {}) in ['IN_REVIEW', 'RESOLVED'] and context.get('issue', {}).get('issueDispositionType', {}).get('title', '') == 'Interim': raise ValidationError()",
     "context": "{ issue(id: $id) { title status issueDispositionType { title } } }",
     "errorState": "BLOCK"
  }
}
```

### Can't install a part to aBOM when text custom attribute is not null

```graphql
{
  "create_rule": {
       "title": "Cannot Install on CAPA Part to aBOM",
       "ruleType": "VALIDATION",
       "eventType": "UPDATE",
       "target": "ABOMITEM",
       "enabled": true
       "code": "if any(attr.get('key','') == 'On CAPA?' and attr.get('value',None) is not None for attr in context.get('abomItem',{}).get('part',{}).get('attributes',[{}])): raise ValidationError()",
       "context": "{abomItem(id:$id){part{attributes{key value}}}}",

       }
  }
```

### Can't kit a part while on CAPA

```graphql
{
  "create_rule": {
    "title": "Cannot Add CAPA Part to Kit",
    "ruleType": "VALIDATION",
    "eventType": "CREATE",
    "target": "PARTKITITEM",
    "code": "if any(attr.get('key','') == 'On CAPA?' and attr.get('value', None) is not None for attr in context.get('partKitItem',{}).get('part',{}).get('attributes',[{}])): raise ValidationError()",
    "context": "{ partKitItem(id:$id){ part{ attributes{ key value } } } }",
    "enabled": true
    }
  }
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://manual.firstresonance.io/features/ion-actions/ion-actions-examples-for-quality.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
