[midPoint] query issue/confusion

Markus Calmius markus.calmius at proton.ch
Wed Apr 2 11:21:20 CEST 2025


Hi,

[Using: midpoint 4.8.5]

I'm trying to create an expression filter for notifications, but I simply cannot get it to work.
General idea is this:
"if CEO has delegated approvals to someone, do not send email to CEO"

Basic issue:
using advanved query in gui, query playground and groovycode in script returns different values.

Set up:
from user CEO I have delegated to two users. When using the advanced search
"assignment/targetRef matches (oid="<oid of ceo>" and targetType=UserType and relation=deputy)"
I get the two users.
Since there is also a delegatedRef, I also tried:
"delegatedRef matches (oid="<oid of ceo>" and relation=deputy)" and got two results.

All good, now, moving to the expressionFilter:
---
queryfor= "assignment/targetRef matches (oid='<oid of ceo>' and targetType=UserType and relation=deputy)"
uQuery = midpoint.queryFor(UserType.class, queryfor)
ceoDelegatedTo = midpoint.searchObjects(uQuery)---

the returned list is empty.
I have tried using the delegatedRef as well, same result.

I have also tried:
----
ref = midpoint.getPrismContext().itemFactory().createReferenceValue(ceoOid, UserType.COMPLEX_TYPE)
ref.setRelation(new QName("deputy")) <- also tried org:deputy
query = prismContext.queryFor(UserType.class)
.item(UserType.F_DELEGATED_REF).ref(ref)
.build()
ceoDelegatedTo = midpoint.searchObjects(UserType.class, query)----
still empty list.

Using the query playground, this:
---
import com.evolveum.midpoint.xml.ns._public.common.common_3.*
queryfor="delegatedRef matches (oid=\"6b1aad6b-02f3-4d2d-8edb-fff371d0bbb6\" and relation=deputy)"uQuery = midpoint.queryFor(UserType.class, queryfor)
---
returns the two users.
Adding:
---
midpoint.searchObjects(uQuery)
---
and I get an error "Expression returned more than one value (2) in "
I have to use:
---
midpoint.searchObjects(uQuery).toString()
---
to get expected two values.

What am I missing here?

Markus Calmius
Proton AG
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20250402/7616ab08/attachment.htm>


More information about the midPoint mailing list