<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Paulo, </div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></div><div class="gmail_default"><span style="font-family:arial,helvetica,sans-serif">We had the same trouble. Currently to use autoassignments you need to get rid of all </span><font face="monospace"><source></font><font face="arial, helvetica, sans-serif"> in the </font>autoassign<font face="arial, helvetica, sans-serif"> mapping and inside the condition check the type of the focus being evaluated by the mapping. </font></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif"><span style="font-family:Arial,Helvetica,sans-serif"><br></span></div><div class="gmail_default"><font face="monospace">import com.evolveum.midpoint.xml.ns._public.common.common_3.UserType</font></div><div><font face="monospace"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"></span>if (<span class="gmail_default" style="font-family:arial,helvetica,sans-serif"> </span>!(focus instanceof UserType)<span class="gmail_default" style="font-family:arial,helvetica,sans-serif"> </span>) { return false }</font><br></div><div><br></div><div><font face="monospace"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">Then you can get what you would have sourced directly from the focal object.</span></font></div><div><font face="monospace"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></font></div><div><font face="monospace"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif">e.g.</span></font></div><div><font face="monospace"><span class="gmail_default">// Standard UserType fields</span></font></div><div><div class="gmail_default"><font face="monospace">givenName = focus.givenName</font></div><div class="gmail_default"><font face="monospace">// UserType extensions (This may not be the best way but it's what worked for us)</font></div><div class="gmail_default"><font face="monospace">unixUid = focus.extension?.getAny()?.find {element -> element.getLocalName() == "unixUid"}<br></font></div><div class="gmail_default"><br></div><div class="gmail_default">Ultimately this solution felt too kludgy for us and we ended up giving up on role autoassignments in favor of assigning them in object templates.</div></div><div class="gmail_default"><br></div><div class="gmail_default">Best, </div><div class="gmail_default"><br></div><div class="gmail_default">Forest</div><div><font face="monospace"><span class="gmail_default" style="font-family:arial,helvetica,sans-serif"><br></span></font></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Mar 30, 2020 at 8:39 AM Paulo Fernandes de Souza Junior <<a href="mailto:PFSJ@senado.leg.br" target="_blank">PFSJ@senado.leg.br</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">




<div dir="ltr" style="font-size:12pt;color:rgb(0,0,0);background-color:rgb(255,255,255);font-family:Calibri,Arial,Helvetica,sans-serif">
<div>Dear All,</div>
<div>I'm having trouble with Autoassignment Roles in our upgrade to Midpoint 4. Some objects like archetypes and object collections, and roles are being evaluated when imported or modified by autoassignment role causing erros like: </div>
<div><br>
</div>
<div>ERROR [com.evolveum.midpoint.init.InitialDataImport] (main) Couldn't import objectCollection:00000000-0000-0000-0001-000000000002(Modification audit records) from file 300-object-collection-audit-modifications.xml: .</div>
<div>com.evolveum.midpoint.util.exception.SchemaException: Cannot find definition of a subitem title of ObjectDeltaObject(null + ObjectDelta(ObjectCollectionType:00000000-0000-0000-0001-000000000002,ADD: objectCollection:00000000-0000-0000-0001-000000000002(Modification
 audit records)) = objectCollection:00000000-0000-0000-0001-000000000002(Modification audit records))</div>
<div><br>
</div>
<div>I found this two links, related with this problem:</div>
<div><br>
</div>
<div>  <a href="https://lists.evolveum.com/pipermail/midpoint/2019-May/005520.html" target="_blank">https://lists.evolveum.com/pipermail/midpoint/2019-May/005520.html</a></div>
<div><br>
</div>
<div>  <a href="https://jira.evolveum.com/browse/MID-5497" target="_blank">https://jira.evolveum.com/browse/MID-5497</a><br>
</div>
<div><br>
</div>
<div>Given this, is Autoassigment roles usable in Midpoint 4, or do I have to use another solution like object templates to auto  assign?​<br>
</div>
<p><br>
</p>
<p>thanks in advance,<br>
</p>
<p><br>
</p>
<div id="gmail-m_-1663948836548086477gmail-m_-5379363480115297119Signature">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px">
<div style="font-family:Tahoma;font-size:13px"><font size="3"><b style="font-family:"Times New Roman""><span style="font-size:10pt;color:rgb(31,73,125)">Paulo Fernandes de Souza Júnior</span></b><b style="font-family:"Times New Roman""><span style="font-size:10pt;color:rgb(23,54,93)"></span></b><span style="font-family:"Times New Roman"">
</span><br style="font-family:"Times New Roman"">
<b style="font-family:"Times New Roman""><span style="font-size:8pt;color:rgb(31,73,125)">NQPPPS<br>
</span></b><span style="font-size:8pt;font-family:"Times New Roman";color:rgb(23,54,93)">Senado Federal -
</span></font><font size="3"><span style="font-size:8pt;font-family:"Times New Roman";color:rgb(31,73,125)">PRODASEN<br>
</span><span style="font-size:8pt;font-family:"Times New Roman";color:rgb(23,54,93)">Fone: 61 3303.3924</span></font><span style="color:rgb(31,73,125)"></span>
<br>
<br>
<p class="MsoNormal"><br>
</p>
</div>
</div>
</div>
</div>
</div>
</div>
</div>

_______________________________________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="https://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">https://lists.evolveum.com/mailman/listinfo/midpoint</a><br>
</blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr">Forest B. Crowley<div>Information Security </div><div><span style="font-size:12.8px">Lehigh University</span></div><div><span style="font-size:12.8px">610-758-3838</span><br></div></div></div></div></div></div></div></div></div></div></div>