Aras Developer
Troubleshooting

Resolving 'There is no tag <Item> in response' Error in Aras Innovator

Daan Theoden
#server events#error handling#EDM StructureDocument
Aras Innovator Error Handling

Resolving “There is no tag in response” Error in Aras Innovator

When working with server events in Aras Innovator, you may encounter the error "There is no tag <Item> in response" while trying to edit an ItemType like EDM StructureDocument. This typically occurs during onAfterAdd server events. Let’s explore the root cause and solution.

Root Cause of the Error

The error occurs because:

  1. The server expects a properly formatted <Item> tag in the response from the apply() method
  2. The response might be malformed or empty due to:
    • Silent failure of the edit operation
    • Incorrect query structure
    • Missing item validation

Solution Approach

Follow these steps to resolve the issue:

1. Verify Query Structure

Ensure your edit request follows proper AML syntax:

<Item type="EDM StructureDocument" action="edit" id="[ITEM_ID]">
    <edm_doku_id>[NEW_VALUE]</edm_doku_id>
</Item>

2. Implement Error Handling

Here’s the improved server-side code with proper error handling:

// Modified code with error handling
Innovator inn = this.getInnovator();

// Get count of existing items
Item results = inn.newItem("EDM StructureDocument", "get");
results = results.apply();
long count = results.getItemCount();

if(count <= MaxItemNumber) {
    string id = this.getID();
    string edmId = count.ToString().PadLeft(10, '0');
    
    // Create edit request
    Item myItem = inn.newItem("EDM StructureDocument", "edit");
    myItem.setAttribute("id", id);
    myItem.setProperty("edm_doku_id", edmId);
    
    // Apply changes and check response
    Item response = myItem.apply();
    if (response.isError()) {
        return response;
    }
    return response;
} else {
    return inn.newError("Error Creating a new EDM Document, the Number of Documents is Maximal");
}

3. Additional Best Practices

  • Always validate the item exists before editing
  • Use try-catch blocks for robust exception handling
  • Log detailed error messages for debugging
  • Test with simple queries first before complex operations

Conclusion

The “There is no tag in response” error typically stems from improper response handling in server-side code. By implementing proper error checking and validation, you can ensure your AML queries return the expected responses. The provided solution demonstrates how to properly structure edit operations and handle potential errors in Aras Innovator server events.

For more advanced error handling techniques, consider exploring Aras Innovator’s server method logging capabilities and the AML debugger tool.