<html>
  <head>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  </head>
  <body>
    <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="color: rgb(51, 51, 51); font-family: "Source
        Sans Pro", "Helvetica Neue", Helvetica, Arial,
        sans-serif; font-size: 14px; font-style: normal;
        font-variant-ligatures: normal; font-variant-caps: normal;
        font-weight: 400; letter-spacing: normal; orphans: 2;
        text-align: start; text-indent: 0px; text-transform: none;
        white-space: normal; widows: 2; word-spacing: 0px;
        -webkit-text-stroke-width: 0px; background-color: rgb(255, 255,
        255); text-decoration-thickness: initial; text-decoration-style:
        initial; text-decoration-color: initial; display: inline
        !important; float: none;">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)">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)">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>
  </body>
</html>