ION Actions examples for Quality

Build custom quality workflows based on the type of issue

Prevent assigning of reviewers to an issue until required fields are filled out

{
  "create_rule": {
    "title": "Issue Can Not Be Put In Progress Without Disposition, Description, Department and Major Subsystem Filled Out",
    "target": "ISSUEAPPROVALREQUEST",
    "enabled": true,
    "eventType": "CREATE",
    "ruleType": "VALIDATION",
    "errorState": "BLOCK",
    "code": "if (context.get('issueApprovalRequests', {}).get('issue', {}).get('status') in ['PENDING', 'IN_PROGRESS', 'IN_REVIEW', 'RESOLVED'] and any([not context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition', []), context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition') is not None and not any(True for item in context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition', [{}]) if item.get('children') and any(True for child in item.get('children', [{}]) if child.get('text') or (child.get('children') and any(True for nested_child in child.get('children', [{}]) if nested_child.get('text') )) )), not context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition', {}), context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition') is not None and not any(True for item in context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition', [{}]) if item.get('children') and any(True for child in item.get('children', [{}]) if child.get('text') or (child.get('children') and any(True for nested_child in child.get('children', [{}]) if nested_child.get('text') )) )), not any([attr['value'] for attr in context.get('issueApprovalRequests', {}).get('issue', {}).get('attributes', [{}]) if attr['key'] == 'Department']), not any([attr['value'] for attr in context.get('issueApprovalRequests', {}).get('issue', {}).get('attributes', [{}]) if attr['key'] == 'Major Subsystem']) ])): raise ValidationError()",
    "context": "{ issueApprovalRequests(filters: {id: {eq: $id}}){ edges{ node{ id issue{ title status expectedCondition disposition issueDispositionType{ title } partInventories { quantity serialNumber lotNumber } attributes { key value } } } } } }"
  }
}

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

Required Fields on Issue before Disposition is Approved

{
  "create_rule": {
     "title": "Issue Can Not Be Put In Progress Without Disposition, Part Inventory, Description, Department and Major Subsystem Filled Out",
     "target": "ISSUEAPPROVALREQUEST",
     "enabled": true,   
     "ruleType": "VALIDATION",
     "eventType": "CREATE",
     "code": "if (context.get('issueApprovalRequests', {}).get('issue', {}).get('status') in ['PENDING', 'IN_PROGRESS', 'IN_REVIEW', 'RESOLVED'] and any([not context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition', []), context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition') is not None and not any(True for item in context.get('issueApprovalRequests', {}).get('issue', {}).get('disposition', [{}]) if item.get('children') and any(True for child in item.get('children', [{}]) if child.get('text') or (child.get('children') and any(True for nested_child in child.get('children', [{}]) if nested_child.get('text') )) )), not context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition', {}), context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition') is not None and not any(True for item in context.get('issueApprovalRequests', {}).get('issue', {}).get('expectedCondition', [{}]) if item.get('children') and any(True for child in item.get('children', [{}]) if child.get('text') or (child.get('children') and any(True for nested_child in child.get('children', [{}]) if nested_child.get('text') )) )), not context.get('issueApprovalRequests', {}).get('issue', {}).get('partInventories', [{}]), not any([attr['value'] for attr in context.get('issueApprovalRequests', {}).get('issue', {}).get('attributes', [{}]) if attr['key'] == 'Department']), not any([attr['value'] for attr in context.get('issueApprovalRequests', {}).get('issue', {}).get('attributes', [{}]) if attr['key'] == 'Major Subsystem']) ])): raise ValidationError()",
     "context": "{ issueApprovalRequests(filters: {id: {eq: $id}}){ edges{ node{ id issue{ title status expectedCondition disposition issueDispositionType{ title } partInventories { quantity serialNumber lotNumber } attributes { key value } } } } } }",
     "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
    }
  }

Issue Order of Approvals

First Approval

{
  "create_rule": {
    "title": "Engineer must approve first",
    "target": "ISSUEAPPROVAL",
    "enabled": true,
    "eventType": "CREATE",
    "ruleType": "VALIDATION",
    "errorState": "BLOCK",
    "context": "{issueApprovals(filters:{id:{eq:$id}}) {edges{node{issueId issue{status approvalRequests{id status role{name}}}}}}}",
    "code": "if context.get('issueApprovals', {}).get('issue', {}).get('issueDispositionType', {}).get('title', '') in ['Rework to Print', 'Repair', 'Retest'] and not any(approval.get('role', {}).get('name') == 'engineer' and approval.get('status') == 'APPROVED' for approval in context.get('issueApprovals', {}).get('issue', {}).get('approvalRequests', [])): raise ValidationError()"
  }
}

Subsequent Approvals

{
  "create_rule": {
    "title": "Order of approvals is Engineer, Quality, then Planner",
    "target": "ISSUEAPPROVAL",
    "enabled": true,
    "eventType": "CREATE",
    "ruleType": "VALIDATION",
    "errorState": "BLOCK",
    "context": "{issueApprovals(filters:{id:{eq:$id}}) {edges{node{issueId issue{status approvalRequests{id status role{name}}}}}}}",
    "code": "if context.get('issueApprovals', {}).get('issue', {}).get('issueDispositionType', {}).get('title', '') in ['Rework to Print', 'Repair', 'Retest'] and any(approval.get('role', {}).get('name') == 'planner' and approval.get('status') == 'APPROVED' for approval in context.get('issueApprovals', {}).get('issue', {}).get('approvalRequests', [])) and not any(approval.get('role', {}).get('name') == 'quality' and approval.get('status') == 'APPROVED' for approval in context.get('issueApprovals', {}).get('issue', {}).get('approvalRequests', [])): raise ValidationError()"
  }
}

Last updated