<div style="font-family: Arial, sans-serif; font-size: 14px;">Hi,</div><div style="font-family: Arial, sans-serif; font-size: 14px;"><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">I am trying to figure out how to make sure all roles are unassigned when a user is removed or disabled from HR. </div><div style="font-family: Arial, sans-serif; font-size: 14px;">I've found: <span><a target="_blank" rel="noreferrer nofollow noopener" href="https://docs.evolveum.com/midpoint/reference/concepts/clockwork/scripting-hooks/">https://docs.evolveum.com/midpoint/reference/concepts/clockwork/scripting-hooks/</a> which contain Example 1 that should do the trick.</span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span>Although, it doesn't quite work on 4.7.2 it seems, I get: "<span>Expression error: Groovy Evaluation Failed: No such property: ContainerDelta for class: (new)_</span>"</span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span><br></span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><span>Two questions:</span></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><ol data-editing-info="{"orderedStyleType":1,"unorderedStyleType":1}" data-listchain="__List_Chain_88"><li style="list-style-type: "1. ";"><span><span></span>is there an easier way?</span></li><li style="list-style-type: "2. ";">trying to figure out what is wrong is not super easy, it's been years since I actually coded. Any guidance is greatly appreciated. I assume the <span style="text-align: start; display: inline !important; background-color: rgb(255, 255, 255);">createModificationDelete has changed some input parameters </span></li></ol></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><div><br></div><div><span><span><span>I'm testing the script in the query playground with one disabled user. </span></span></span></div><expression></div><div style="font-family: Arial, sans-serif; font-size: 14px;"><div><span>    <script></span></div><div><span>     <code></span></div><div><span>            import com.evolveum.midpoint.xml.ns._public.common.common_3.*;</span></div><div><span>            import com.evolveum.midpoint.prism.*;</span></div><div><br></div><div><span>        UserType user = (UserType) midpoint.searchObjectByName(UserType.class, '<redacted username>');</span></div><div><span>          ActivationStatusType administrativeStatus = user.getActivation().getEffectiveStatus();</span></div><div><span>        if (administrativeStatus == ActivationStatusType.DISABLED) {</span></div><div><span>                for (AssignmentType assign : user.getAssignment()) {</span></div><div><span>                    changed = false;</span></div><div><span>                    assignmentDelta = ContainerDelta.createModificationDelete(UserType.F_ASSIGNMENT, UserType.class, prismContext, assign.clone());</span></div><div><span>                    modelContext.getFocusContext().swallowToSecondaryDelta(assignmentDelta);</span></div><div><span>                    changed = true;</span></div><div><span>                }</span></div><div><span>                if (changed) {</span></div><div><span>                    modelContext.rot(); // this makes Projector to recompute the model context</span></div><div><span>                }</span></div><div><span>          }</span></div><div><span>         </code></span></div><div><span>   </script></span></div><div><span></expression></span></div><span></span><br></div><div style="font-family: Arial, sans-serif; font-size: 14px;">Thanks in Advance</div>
<div class="protonmail_signature_block" style="font-family: Arial, sans-serif; font-size: 14px;">
    <div class="protonmail_signature_block-user">
        Markus</div>
    
            <div class="protonmail_signature_block-proton protonmail_signature_block-empty">
        
            </div>
</div>