<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
Use input == null in the condition.
<div><br>
</div>
<div><br>
<div>
<div id="Signature">
<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 style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>De:</b> midPoint <midpoint-bounces@lists.evolveum.com> em nome de Mercedes Oncina Deltell via midPoint <midpoint@lists.evolveum.com><br>
<b>Enviado:</b> quarta-feira, 16 de fevereiro de 2022 10:15<br>
<b>Para:</b> midpoint@lists.evolveum.com<br>
<b>Cc:</b> Mercedes Oncina Deltell<br>
<b>Assunto:</b> [midPoint] Error in script condition during inbound mapping</font>
<div> </div>
</div>
<div>
<p>Hello again.</p>
<p>I have learned a lot about midPoint during last week. Now, I have a new question.</p>
<p>I want to import an attribute which could be null in the database table, it is mapped into the employeeNumber attribute of the user schema in midPoint. If it is null in the database, I want to random generate a value and map it into the attribute, but if
 it contains a value, I just only want to import it.</p>
<p>As this employeeNumber should always have a value in midPoint, it is mapped out to the property AFI_ID in the database table. My objective is, if in database the value is null, midPoint will generate this value and then, update it to the database again.<br>
</p>
<p>I have tried many configurations and (I think) I know where the problem is, in the script code of the condition of the inbound mapping:<br>
</p>
<p>            <font size="2"><i><attribute id="30"></i><i><br>
</i><i>                <b><ref>ri:AFI_ID</ref></b></i><i><br>
</i><i>                <description>Identificador único, generado automáticamente</description></i><i><br>
</i><i>                <matchingRule xmlns:gen459=<a class="moz-txt-link-rfc2396E" href="http://prism.evolveum.com/xml/ns/public/matching-rule-3">"http://prism.evolveum.com/xml/ns/public/matching-rule-3"</a>>gen459:default</matchingRule></i><i><br>
</i><i>                <tolerant>true</tolerant></i><i><br>
</i><i>                <exclusiveStrong>false</exclusiveStrong></i><i><br>
</i><b><i>                <outbound></i></b><i><br>
</i><i>                    <authoritative>true</authoritative></i><i><br>
</i><i>                    <exclusive>false</exclusive></i><i><br>
</i><i>                    <strength>normal</strength></i><i><br>
</i><i>                   <b> <source></b></i><b><i><br>
</i></b><b><i>                        <path>$focus/employeeNumber</path></i></b><b><i><br>
</i></b><b><i>                    </source></i></b><b><i><br>
</i></b><b><i>                </outbound></i></b><i><br>
</i><i>                <inbound id="49"></i><i><br>
</i><i>                    <authoritative>true</authoritative></i><i><br>
</i><i>                    <exclusive>false</exclusive></i><i><br>
</i><i>                    <strength>normal</strength></i><i><br>
</i><i>                    <b><expression></b></i><b><i><br>
</i></b><b><i>                        <generate/></i></b><b><i><br>
</i></b><b><i>                    </expression></i></b><i><br>
</i><i>                    <target></i><i><br>
</i><i>                        <path>$focus/employeeNumber</path></i><i><br>
</i><i>                    </target></i><i><br>
</i><i>                    <b><condition></b></i><b><i><br>
</i></b><b><i>                        <script></i></b><b><i><br>
</i></b><b><i>                           <code></i></b><b><i><br>
</i></b><b><i>                              $projection/attributes/AFI_ID == null</i></b><b><i><br>
</i></b><b><i>                           </code></i></b><b><i><br>
</i></b><b><i>                        </script></i></b><b><i><br>
</i></b><b><i>                    </condition></i></b><i><br>
</i><i>                </inbound></i><i><br>
</i><i>            </attribute></i></font><br>
</p>
<p>But this configuration is not correct, maybe because it is not a Groovy expression, the error when I try to reconcile or import an user is:</p>
<p><span style="">Groovy Evaluation Failed: No such property: $projection for class: condition_in_mapping_in_inbound_expression_for_AFI_ID_in_resource_3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT(actor=user:00000000-0000-0000-0000-000000000002(administrator);
 input=PPV(String:wB7TPNFn); resource=<a class="moz-txt-link-freetext" href="">resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)</a>; configuration=systemConfiguration:00000000-0000-0000-0000-000000000001(SystemConfiguration); focus (user)=user:null(null);
 projection (shadow, account)=shadow:4a56dbf2-93ab-4ae5-8b4d-3747f34711fe(34812808); operation=add; ) in condition in mapping in inbound expression for AFI_ID in
<a class="moz-txt-link-freetext" href="">resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)</a></span></p>
<p>Could anyone advice me about this kind of expressions?</p>
<p>Thanks in advance.<br>
</p>
<pre class="moz-signature" cols="72">-- 
Mercedes Oncina Deltell
Servicio de Infraestructuras TICS
ATICA - Universidad de Murcia
Telf: +34 868881983</pre>
</div>
</div>
</div>
</div>
</body>
</html>