ION Actions examples for Runs and Procedures

All Steps Need Dependencies:

{
  "create_rule": {
    "enabled": true,
    "title": "Check if Step has dependencies",
    "target": "PROCEDURE",
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "errorState": "ALLOW",
    "context": "{ procedure(id: $id) { id steps{location{name} upstreamStepIds downstreamStepIds } } }",
    "code": "if (context.get('changes', {}).get('procedures', {}).get('status', {}).get('new') == 'in_review' and any([step for step in context.get('procedure', {}).get('steps', []) if not (step.get('upstreamStepIds') or step.get('downstreamStepIds'))])): raise ValidationError()"
  }
}

All Child Steps Need Dependencies:

{
  "create_rule": {
    "enabled": true,
    "title": "Check if Child Step has dependencies",
    "target": "PROCEDURE",
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "errorState": "ALLOW",
    "context": "{ procedure (id: $id) { id steps { location { id } title isStandardStep steps { title isStandardStep downstreamStepIds upstreamStepIds location { name } } } } }",
    "code": "if context.get('changes', {}).get('procedures', {}).get('status', {}).get('new') == 'in_review' and any([step for step in context.get('procedure', {}).get('steps', []) if 'steps' in step and len(step.get('steps', [])) > 1 and any([nested_step for nested_step in step.get('steps', []) if not nested_step.get('upstreamStepIds') and not nested_step.get('downstreamStepIds')])]): raise ValidationError()"
  }
}

All Steps Need a Location

All Child Steps Need a Location

A Procedure can only move to ‘In Review’ when the correct reviewers from the correct teams have been added:

Check if the custom attribute ‘Procedure Type’ is filled out

Last updated

Was this helpful?