[midPoint] bulk action task for removing assignment

Pavol Mederly mederly at evolveum.com
Thu Aug 17 20:34:44 CEST 2023


Hello Paul,

this is a quirk from the prehistory of midPoint: references are not 
filtered using q:equal but using q:ref.

Furthermore, you may eliminate custom coding by using "unassign" action 
that provides a filter for assigments to be removed.

See e.g. 
https://github.com/Evolveum/midpoint/blob/75e549f2e5ce52ab4b008c18e2e7ba8b2072e151/model/model-intest/src/test/resources/scripting/unassign-captain-from-jack.xml#L18-L26 
for an example.

Hope this helps. No guarantees, though. :)

-- 
Pavol Mederly
Software developer
evolveum.com

On 17/08/2023 17:03, Paul Caskey via midPoint wrote:
>
> I am trying to remove all user assignments to OrgType objects in a 
> bulk action task but am having trouble.
>
> I think I have the filter correct, but I’m having trouble with the 
> script when it tries to examine the type on a given assignment (to 
> prepare it for deletion).
>
> This is the filter:
>
>                         <q:filter>
>
>                             <q:equal>
>
> <q:path>assignment/targetRef</q:path>
>
>                                 <q:value type="OrgType" />
>
> </q:equal>
>
>                         </q:filter>
>
> And this is the first part of the script that checks the assignment 
> for a user:
>
>                                   UserType user = input as UserType
>
>                                   for (AssignmentType assignment : 
> user.getAssignment()) {
>
>                                         if (aassignment.targetRef.type 
> == 'OrgType') {
>
> The error I am getting is:
>
> class com.evolveum.midpoint.prism.impl.PrismReferenceValueImpl cannot 
> be cast to class com.evolveum.midpoint.prism.PrismPropertyValue 
> (com.evolveum.midpoint.prism.impl.PrismReferenceValueImpl and 
> com.evolveum.midpoint.prism.PrismPropertyValue are in unnamed module 
> of loader org.springframework.boot.loader.LaunchedURLClassLoader 
> @2e0fa5d3)
>
> Thanks in advance for any help!
>
> -Paul
>
>
> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> https://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20230817/6049e974/attachment.htm>


More information about the midPoint mailing list