[midPoint] Error in script condition during inbound mapping

Mercedes Oncina Deltell moncina at um.es
Wed Feb 16 14:15:51 CET 2022


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">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/61772317/attachment.htm>


More information about the midPoint mailing list