[midPoint] Error in script condition during inbound mapping
Paulo Fernandes de Souza Junior
PFSJ at senado.leg.br
Wed Feb 16 18:18:49 CET 2022
Use input == null in the condition.
Paulo Fernandes de Souza Júnior
NQPPPS
Senado Federal - PRODASEN
Fone: 61 3303.3924
________________________________
De: midPoint <midpoint-bounces at lists.evolveum.com> em nome de Mercedes Oncina Deltell via midPoint <midpoint at lists.evolveum.com>
Enviado: quarta-feira, 16 de fevereiro de 2022 10:15
Para: midpoint at lists.evolveum.com
Cc: Mercedes Oncina Deltell
Assunto: [midPoint] Error in script condition during inbound mapping
Hello again.
I have learned a lot about midPoint during last week. Now, I have a new question.
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.
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.
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:
<attribute id="30">
<ref>ri:AFI_ID</ref>
<description>Identificador único, generado automáticamente</description>
<matchingRule xmlns:gen459="http://prism.evolveum.com/xml/ns/public/matching-rule-3"<http://prism.evolveum.com/xml/ns/public/matching-rule-3>>gen459:default</matchingRule>
<tolerant>true</tolerant>
<exclusiveStrong>false</exclusiveStrong>
<outbound>
<authoritative>true</authoritative>
<exclusive>false</exclusive>
<strength>normal</strength>
<source>
<path>$focus/employeeNumber</path>
</source>
</outbound>
<inbound id="49">
<authoritative>true</authoritative>
<exclusive>false</exclusive>
<strength>normal</strength>
<expression>
<generate/>
</expression>
<target>
<path>$focus/employeeNumber</path>
</target>
<condition>
<script>
<code>
$projection/attributes/AFI_ID == null
</code>
</script>
</condition>
</inbound>
</attribute>
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:
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=resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES); 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 resource:3a091f48-850c-4ee8-ae1c-eac5c264c41c(MIDPOINT.AFILIACIONES)
Could anyone advice me about this kind of expressions?
Thanks in advance.
--
Mercedes Oncina Deltell
Servicio de Infraestructuras TICS
ATICA - Universidad de Murcia
Telf: +34 868881983
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220216/53f41c2a/attachment-0001.htm>
More information about the midPoint
mailing list