The issue is happening because the returned result structure from OQL does not match the structure of your Non-Persistable Entity.
With View Entities, Mendix internally handles the result set, and if the query does not define the result shape properly, additional metadata/identifier columns can appear during mapping.
Instead of trying to map the generated ID, I normally keep the OQL result exactly aligned with the expected output.
A common approach is:
SELECT
AuditName AS Name
FROM AppMain.AuditUserView
GROUP BY AuditName
The idea is:
Example:
Non-Persistable Entity:
AuditResult └── Name (String)
OQL:
SELECT
AuditName AS Name
FROM AppMain.AuditUserView
GROUP BY AuditName
Now the runtime mapping becomes: AuditName → Name without expecting the generated ID column.
This approach keeps the OQL result clean and avoids the mapping error.
Kindly mark this as the accepted answer if it helps.
Dear Krishnakumar
i used your approach, but it does not work, the error still exists.
Caused by: com.mendix.core.CoreRuntimeException: com.mendix.systemwideinterfaces.MendixRuntimeException: java.lang.RuntimeException: Could not find result association ID in target object.
My OQL in microflow:
select C.asn as asn
from BinGR.CDH_Bin_GR_AggASN_View C
group by asn
from BinGR.CDH_Bin_GR_AggASN_View is a OQL Entity
Hi Muthukutti,
This looks like a compatibility issue between the OQL Module's Execute OQL Statement action and View Entities, rather than an error in your OQL syntax.
Your query is valid:
SELECT AuditName AS Name FROM AppMain.AuditUserView
The OQL Module maps each result column to an attribute or association with the same name in the specified return entity. If the result contains an unexpected ID column, the mapping can fail with Could not find result association ID in target object.
Option 1 — Retrieve the View Entity directly (preferred)
Instead of using Execute OQL Statement, use a Retrieve activity in your microflow to retrieve objects of AppMain.AuditUserView.
If you need the results in a non-persistable entity, loop through the retrieved View Entity objects and create corresponding non-persistable objects, copying the required attributes.
View Entities are designed to be retrieved directly in microflows and pages.
Option 2 — If you need dynamic OQL queries
If you specifically require Execute OQL Statement because the query is dynamic, try querying the underlying persistable entities directly instead of querying the View Entity. This avoids the problematic View Entity result mapping.
Also, check your installed OQL Module version. Version 4.1.0 included a fix related to handling non-aliased ID columns, so make sure you're using an appropriate updated version for your Mendix 10.24 application.
I wouldn't add an ID attribute or association to your non-persistable entity as a workaround. The error indicates a mismatch in the result mapping, and adding a field may not resolve the underlying issue.
My recommendation: If the query logic is already defined in AuditUserView, retrieve that View Entity directly. This avoids duplicating your OQL logic and is the cleaner approach.
Hope this helps.