137

Introduction to AML: The Backbone of Aras Innovator Automation

Introduction to AML In the world of Aras Innovator, AML (Aras Markup Language) is the silent workhorse — a powerful…

Introduction to AML

In the world of Aras Innovator, AML (Aras Markup Language) is the silent workhorse — a powerful XML-based query and command language designed to interact with every layer of the platform. If you’ve ever automated a workflow, extracted complex data, or integrated Aras with external systems, chances are you’ve already used AML — even if indirectly through the API.

Unlike SQL, which talks directly to a database, AML operates at the business object level, respecting Aras Innovator’s data model, permissions, and lifecycle rules. This ensures that every query, update, or transaction is validated exactly as if it were performed manually in the UI.

Why AML is Special:

  • It’s declarative yet transactional — a single AML statement can create, update, and relate multiple items in one atomic operation.
  • It supports multi-level querying, retrieving deeply nested related items without multiple round-trips.
  • It plays nicely with permissions, preventing accidental bypass of security rules that raw SQL could allow.

Basic Anatomy of an AML Statement

At its simplest, AML wraps an Item element with attributes that define:

  • Type of business object (ItemType)
  • Action (e.g., get, add, edit, delete)
  • Select clause to control returned properties
  • Where clauses for filtering

Example:

<Item type="Part" action="get" select="item_number,name">
    <item_number>12345</item_number>
</Item>

This retrieves the item_number and name for the Part with the specified item number.


Tricks & Secrets from the Field

1. Chained Queries with Relationships

Pull related data in a single AML call:

<Item type="Part" action="get" select="item_number,name">
    <Relationships>
        <Item type="Part BOM" action="get" select="quantity">
            <related_id>
                <Item type="Part" select="item_number,name" />
            </related_id>
        </Item>
    </Relationships>
</Item>

💡 Benefit: Avoids multiple server calls and ensures synchronized data.


2. Selective Retrieval for Performance

Always use select to avoid pulling unnecessary data — this can cut payload size by up to 90% in complex queries.


3. Triggering Server Events

Every AML action respects server events (OnBeforeAdd, OnAfterGet, etc.).
Simply mimicking a real transaction in AML can trigger workflows without UI interaction.


4. Multi-Action Batching

Run multiple commands in one transaction:

<Item type="Part" action="add">
    <item_number>12345</item_number>
</Item>
<Item type="Document" action="add">
    <item_number>DOC-001</item_number>
</Item>

💡 Secret: If one fails, all rollback.


5. Wildcard Searches

💡 Warning: Bypasses security and business rules — use for controlled migrations only.


7. Versioned Data Fetching

<Item type="Part" action="get" select="item_number,name">
    <config_id>1234ABCD5678</config_id>
    <generation>2</generation>
</Item>

💡 Use Case: Retrieve historical versions without affecting the current state.


8. Cloning Items

<Item type="Part" action="copy">
    <id>1234ABCD5678</id>
</Item>

💡 Tip: Works with all relationships depending on item configuration.


9. Relationship Queries Without the Parent

<Item type="Part BOM" action="get" select="quantity">
    <related_id>
        <Item type="Part" select="item_number" />
    </related_id>
</Item>

💡 Benefit: Useful for BOM analysis without needing to query the main Part first.


10. Controlled Updates (Patch Style)

<Item type="Part" action="edit">
    <id>1234ABCD5678</id>
    <name>Updated Name</name>
</Item>

💡 Note: Only specified properties are updated; others remain untouched.


AML Power Cheat Sheet

Below is a consolidated reference table for quick recall:

Action TypeExampleSecret/Tip
Get Specific Fields<Item type="Part" action="get" select="item_number,name" />Use select to boost speed
Wildcard Search<item_number condition="like">ABC%</item_number>% works like SQL LIKE
Multi-Level QueryNested <Relationships>Avoids multiple calls
Multiple ActionsTwo <Item>s in same envelopeRuns in one transaction
Delete with Filter<Item type="Doc" action="delete">...</Item>Respects permissions
Get Latest<Item id="LATEST" />Always fetches latest version
SQL Mode<Item action="sql">...</Item>Admin only, dangerous
Clone Item<Item action="copy">...</Item>Copies properties & relationships

Why Mastering AML Matters

Becoming fluent in AML transforms you from a regular Aras Innovator user into a platform power engineer. With AML, you can:

  • Build dynamic integrations
  • Extract complex hierarchical data in one go
  • Automate bulk operations safely
  • Debug and troubleshoot permissions and workflows

In short: AML is your backstage pass to Aras Innovator’s engine room. Learn it well, and you can bend the system to fit business needs with speed and precision.

Youssef Abou Afach

Leave a Reply

Your email address will not be published. Required fields are marked *