ION Factory OS
  • Welcome to ION
  • Features
    • Procedures
      • Steps
        • Content
        • Datagrid
        • Fields
        • Attributes
      • Dependencies
      • Part-Procedure Relationship
      • Attributes
      • Standard Steps
      • Installation Requirements (Beta)
      • Nested Steps and Nested Standard Steps
      • Procedure Best Practices
    • Runs
      • Run Execution Overview
      • Runs And Step States
      • Batching Runs
        • Batching 2.0 Changes
      • Workcenter execution
      • Split Inventory on a Run
      • Redlines
      • Export run data
      • Scheduling runs
      • Time Tracking
      • Attributes
      • Outside Processing
      • Runs Best Practices
    • Parts Library
      • As-built Bill of Materials (aBOM)
        • Editing aBOM build requirements
        • aBOM Beta Changes
          • aBOM actions for developers
      • Inventory
        • Inventory status
        • Inventory splitting
        • Inventory merging
        • Inventory scrapping
        • Kitting
        • Inventory Movement Automations
      • Manufacturing bill of materials (mBOM)
        • mBOM versions
        • Made on Assembly (MOA)
        • Part Substitutes
        • Reference designators
      • Part Attributes
      • Part revision interchangeability
      • Supplier Part Numbers & Purchase Unit Conversions
    • Kitting and Inventory Fulfilment
      • Kit Statuses and Workflows
      • Inventory requests
      • Kitting and runs
      • Fulfilling Multiple Kits
      • Kanban Kitting
    • Purchasing
      • Purchase Orders
        • Types of Purchases
        • Purchase Order Approvals
        • Purchase Order FAQs
        • Supplier Part Numbers & Unit Conversions
        • PO Requirements, Terms, and Quality Clauses
        • PO lines editability changes
      • Receiving/Inspection
      • Outside Processing
      • Consigned Parts
    • Barcode Labels
      • Templating
        • ION barcode minimum sizes
        • Sample templates
      • Printing
        • Configuring Zebra Browser Print
        • Server Based Barcode Printing (PrintNode)
      • Scanning
        • Scan barcodes from other systems
    • Quality
      • Issues
      • Further Actions - CAPA
      • Issues States, Dispositions, and Resolutions
      • Quality Best Practices
    • Tools
    • Locations
    • Attributes
    • Labels
      • Deleting labels
    • Notifications
    • Search
    • Settings
      • Role based access control
        • Full Glossary of ION Permissions
    • ION Actions
      • ION Actions examples for Quality
      • ION Actions examples for Runs and Procedures
      • ION ACTIONS examples for Supply Chain
  • Analytics
    • Inventory valuation
    • Part impact analysis
    • Users, Roles, Teams
    • Analytics FAQ
    • Data Connector
    • Data Products
  • Plans and Autoplan
    • Autoplan
    • Autoplan glossary
    • Preparing to use Autoplan
    • Clear to build reporting
    • Running Autoplan on a schedule
    • Firm and blocked plan items
    • Location constraints
    • Autoplan suggested suppliers and procedures
    • Reorder point
    • Plan input serial numbers
    • Applying a calendar
    • Plan Reservations
    • Independent schedules
    • Drive demand from kits
    • Drive demand below buy parts configuration
    • Group plan items with the same date
    • Manualy Changing Autoplan Status
  • API
    • How to create an App with ION
    • Access Tokens
    • About GraphQL
    • Interactive API explorer
    • API Keys
    • Examples
      • Notifications
      • Runs
      • Automatically updating fields in runs
      • Parts and Part Revisioning
      • mBOMs
      • Part Inventory and Kitting
      • aBOM (As-built Bill of Materials)
      • Edit time-tracking session data
    • Changelog
    • Webhooks
    • Pagination
  • Automations
    • Auto-checkout of Run Steps
    • Auto-Consumption of Lineside Inventory
    • Automatically Send Purchases to Suppliers
    • Set Close by Run Step on Issue Creation
    • Intent Management / Grade / Tier / Pedigree
      • Data Imprinting
      • ION Actions for Intent
    • Auto-Update mBOM Revision on Part Revision Update
    • Auto-approve part-procedure relationships
    • Purchase Order PDF and Versions
    • Auto Populate PO Line Attributes
    • Imprint Attributes from One Object to Another on a Desired Event
    • Kit Packing/Pick List PDF
  • Integrations
    • Deploying Integrations and Automations
    • Arena
    • Cofactr
    • Datum
    • Duro
    • NetSuite
      • Purchasing in NetSuite, Receiving in ION
      • Work Order/Assembly Builds
    • Procurable
    • PDF Generator
    • Quickbooks
    • Ramp
    • Silkline Integration
    • Slack
    • Smartsheet
    • SOLIDWORKS
    • Teamcenter
    • Integrating with ERP Best Practices
  • Training
    • Standard Operating Procedures
      • Cycle Counting
      • Tool Utilization
    • Guided Flows
    • ION Sandbox
    • Chat Support for ION
  • Troubleshooting
    • Resetting your password
    • Resetting your Multi-Factor Authentication
    • You have no roles... error
  • Changelog
  • Adminstration
    • Security
      • Backups and Security FAQ
      • Single Sign-On (SSO)
        • Okta SAML connection setup
      • Export Control
      • Report Generator Disclaimer
    • Browser and Device Compatibility
    • Authentication
      • My company is new to ION, logging in for the first time.
      • I'm told I'm not authorized to access the application
      • My account has been deactivated
    • Login Page
  • Tickets Portal
Powered by GitBook
On this page
  • Required fields before approval
  • Purchase Approvals
  • STEP 1 Set up roles
  • STEP 2 Installing your rule (test in staging first!)
  • No permission to edit inventory
  • Receipt line items must have a location
  • Required fields for part creation

Was this helpful?

  1. Features
  2. ION Actions

ION ACTIONS examples for Supply Chain

Required fields before approval

Mandate that specific PO line attributes are populated before submitting for approval

{
  "enabled": true,
  "title": "Purchase line items must have a need date",
  "target": "PURCHASEORDERLINE",
  "eventType": "UPDATE",
  "ruleType": "VALIDATION",
  "errorState": "ALLOW",
  "context": "{ purchaseOrderLine(id: $id) { id needDate } }",
  "code": "if context.get('changes', {}).get('purchaseOrderLines', {}).get('status', {}).get('new') == 'requested' and context.get('purchaseOrderLine', {}).get('needDate') is None: raise ValidationError()"
}

Mandate that specific PO header (custom) attributes are populated before submitting for approval

{
            "enabled": true,
            "title": "Purchase requires a justification before it can be ordered"
            "target": "PURCHASEORDERLINE",
            "eventType": "UPDATE",
            "errorState": "ALLOW",
            "context": "{ purchaseOrderLine(id: $id) { purchaseOrder {id attributes {key value}}  } }",
            "code": "if context.get('changes', {}).get('purchaseOrderLines', {}).get('status', {}).get('new') == 'requested' and any(attribute.get('key') == 'PO Justification' and not attribute.get('value') for attribute in context['purchaseOrderLine'].get('purchaseOrder', {}).get('attributes', [])): raise ValidationError()"      
 }

Purchase Approvals

How to use ION actions to enforce Purchases have proper approvals

STEP 1 Set up roles

  • You’ll need to add roles (or teams - see note below)and assign them to users, for as many approval levels as your organization has (e.g. Manager, Director, VP)

  • You can also use Teams instead of roles (see next comment below)

STEP 2 Installing your rule (test in staging first!)

If you wish to use the “teams” feature instead of "roles", toggle anywhere it says "role" to "team" in the code below.

The mutation to create a rule:

mutation CreateRule($create_rule: CreateRuleInput!) {
  createRule(input: $create_rule) {
    rule {
      id
      title
      context
      code
      _etag
      enabled
      target
    }
  }
}

Query variables: There are two rules to install per role:

  • Rule 1: Prevent submission for approval (DRAFT > IN REVIEW) without a manager.

  • Rule 2: Prevent ordering (APPROVED > ORDERED) without a manager’s approval (this is a loophole in which the user can remove the approval request once the status is in “IN REVIEW”

Repeat this step for every role & approval level in your org by modifying the "Manager" and "$10,000" below:

Rule 1:

{
  "create_rule": {
    "enabled": true,
    "title": "Add a Manager for purchases over $10,000",
    "target": "PURCHASEORDERLINE",
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "errorState": "ALLOW",
  "context": "{ purchaseOrderLine(id: $id) { id purchaseOrder { estimatedCost approvalRequests { reviewer { roles { name } } } } } }",
     "code": "if context.get('changes', {}).get('purchaseOrderLines', {}).get('status', {}).get('new') == 'requested' and context.get('purchaseOrderLine', {}).get('purchaseOrder', {}).get('estimatedCost', 0) > 10000 and not any(role.get('name') == 'Manager' for approvalRequest in context.get('purchaseOrderLine', {}).get('purchaseOrder', {}).get('approvalRequests', []) for role in approvalRequest.get('reviewer', {}).get('roles', [])): raise ValidationError()"
   }
}

Rule 2:

{
  "create_rule": {
    "enabled": true,
    "title": "You need a manager's approval for purchases over $10,000",
    "target": "PURCHASEORDERLINE",
    "eventType": "UPDATE",
    "ruleType": "VALIDATION",
    "errorState": "ALLOW",
    "context": "{ purchaseOrderLine(id: $id) { id status purchaseOrder { estimatedCost approvals { reviewer { name roles { name } } } } } }",
    "code": "if context.get('changes', {}).get('purchaseOrderLines', {}).get('status', {}).get('new') == 'ordered' and context.get('purchaseOrderLine', {}).get('purchaseOrder', {}).get('estimatedCost', 0) > 10000 and not any(role.get('name') == 'Manager' for approval in context.get('purchaseOrderLine', {}).get('purchaseOrder', {}).get('approvals', []) for role in approval.get('reviewer', {}).get('roles', [])): raise ValidationError()"
  }
}

That's it! Be sure to test for any quirky unintended behaviors!

No permission to edit inventory

Prevent certain roles from editing inventory while still allowing them to move the location and split inventory as needed.

{
  "create_rule": {
    "title": "No Permissions to Edit Inventory",
    "ruleType": "VALIDATION",
    "eventType": "UPDATE",
    "target": "PARTINVENTORY",
    "code": "if not context['changes'].get('partsInventory', {}).get('location_id', {}) and not context['changes'].get('abomItems', {}).get('quantity', {}) and not set(context.get('currentUser', {}).get('roles', {})).intersection(set(['Quality Engineer', 'Quality Inspector', 'Reliability Engineer'])): raise ValidationError()",
    "context": "{ partInventory(id: $id) { id _etag location { id name } } }",
    "enabled": false
    }

Receipt line items must have a location

{
  "create_rule": {
    "title": "Receipt line items must have a location",
    "ruleType": "VALIDATION",
    "eventType": "CREATE",
    "target": "RECEIPTITEM",
    "code": "if context.get('receiptItem', {}).get('partInventory', {}).get('locationId') is None: raise ValidationError()",
    "context": "{ receiptItem(id: $id) { id partInventory{locationId} } }",
    "enabled": true
    }
}
    

Required fields for part creation

{
    "create_rule": {
    "title": "Required fields for part creation",
    "ruleType": "VALIDATION",
    "eventType": "CREATE",
    "target": "PART",
    "code": "if (context.get('part', {}).get('partType') == 'PART') and any([not context.get('part', {}).get('revision') == '', not context.get('part', {}).get('description') == '', not context.get('part', {}).get('trackingType') == '', not context.get('part', {}).get('sourcingStrategy') == '', not context.get('part', {}).get('unitOfMeasure') == '']): raise ValidationError()",
    "context": "{ part(id: $id) { id revision revisionScheme description trackingType sourcingStrategy partType unitOfMeasure { id } attributes { key value } } }",
    "enabled": false
    }
}
PreviousION Actions examples for Runs and ProceduresNextAnalytics

Last updated 1 year ago

Was this helpful?

If you need to disable or modify these rules, use the instructions provided .

here