ION Actions examples for Quality

Build custom quality workflows based on the type of issue

Open Redlines Prevent Moving Issue Into In Review

{ 
  "create_rule": {
    "title": "Open Redlines Prevent Moving Issue into In Review",
    "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"
  }
}

No Permission To Reopen A Closed Issue

{
  "create_rule": {
    "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"
  }
}

Issues Cannot be Closed with an Interim Dispositions

{
  "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

{
  "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

{
  "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
    }
  }

Last updated

Was this helpful?