<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hi Santiago,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
I think if "Aliases" is multivalue you need to loop through the values to compare the values ony by one. Aliases should be present as array of values, so you can use a for loop for example for the comparison.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Hope it helps.</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Kind regards,</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
Fabian</div>
<div>
<div id="appendonsend"></div>
<div style="font-family:Calibri,Arial,Helvetica,sans-serif; font-size:12pt; color:rgb(0,0,0)">
<br>
</div>
<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>Von:</b> Sanudo Martinez, Santiago <Santiago.SanudoMartinez@ingrammicro.com><br>
<b>Gesendet:</b> Montag, 24. Januar 2022 12:48<br>
<b>An:</b> midpoint@lists.evolveum.com <midpoint@lists.evolveum.com><br>
<b>Betreff:</b> [midPoint] Account Sync: Correlation using multivalued attribute</font>
<div> </div>
</div>
<div lang="EN-US" style="word-wrap:break-word">
<div class="x_WordSection1">
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color:#4472C4">Hi,<br>
<br>
I have the following attribute in my shadows (EmployeeId, Aliases):<br>
<br>
I am trying to map the employeeId against the user employeeNumber which works OK and the aliases (which is a multivalued field against the user emailAddress). Whenever I try to give the aliases to match against the emailAddress I get the following error that
 I can’t compare emailAddress against more than 1 item. Any ideas how can I compare all the fields inside the multivalued field against the emailAddress?¿<br>
<br>
<br>
<img width="1559" height="513" id="x__x0000_i1026" style="width:16.2395in; height:5.3437in" data-outlook-trace="F:1|T:1" src="cid:image002.png@01D81120.A37EA000"><br>
<br>
<br>
here you may find the resource xml:<br>
<br>
<br>
<br>
<?xml version="1.0" encoding="UTF-8"?><br>
<br>
<resource oid="6a23afee-0426-4c52-85d4-7223cc4829c8"<br>
          xmlns="http://midpoint.evolveum.com/xml/ns/public/common/common-3"<br>
          xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3"<br>
          xmlns:q="http://prism.evolveum.com/xml/ns/public/query-3"<br>
          xmlns:icfs="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3"<br>
          xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3"<br>
          xmlns:xsd="http://www.w3.org/2001/XMLSchema"<br>
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"<br>
          xmlns:icfc="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/connector-schema-3"<br>
          xmlns:cap="http://midpoint.evolveum.com/xml/ns/public/resource/capabilities-3"><br>
<br>
<br>
    <connectorRef type="ConnectorType"><br>
        <filter><br>
            <q:equal><br>
                <q:path>c:connectorType</q:path><br>
                <q:value>ingrammicro.com.connector.csv.cmp.CsvConnector</q:value><br>
            </q:equal><br>
        </filter><br>
    </connectorRef><br>
<br>
    <br>
<br>
    <schemaHandling><br>
        <objectType><br>
            <kind>account</kind><br>
            <intent>default</intent><br>
            <displayName>Default Account</displayName><br>
            <objectClass>ri:AccountObjectClass</objectClass><br>
            <default>true</default><br>
            <multiplicity><br>
                <maxOccurs>unbounded</maxOccurs><br>
            </multiplicity><br>
<br>
            <attribute><br>
            <c:ref xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">ri:UserPrincipalName</c:ref><br>
<br>
            </attribute><br>
<br>
            <attribute><br>
                <c:ref xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">ri:EmployeeId</c:ref><br>
<br>
            </attribute><br>
<br>
            <attribute><br>
                <c:ref xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">ri:Aliases</c:ref><br>
                <limitations><br>
                    <minOccurs>0</minOccurs><br>
                    <maxOccurs>unbounded</maxOccurs><br>
                </limitations><br>
                <inbound><br>
                    <target><br>
                        <c:path>$focus/extension/emailAlias</c:path><br>
                    </target><br>
                </inbound><br>
            </attribute><br>
            <attribute><br>
                <c:ref xmlns:ri="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">ri:AccountEnabled</c:ref><br>
            </attribute><br>
        </objectType><br>
    </schemaHandling><br>
<br>
    <synchronization><br>
        <objectSynchronizationSorter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ObjectSynchronizationSorterType"><br>
            <expression><br>
                <trace>false</trace><br>
                <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="c:ScriptExpressionEvaluatorType"><br>
                    <code><br>
                        import com.evolveum.midpoint.xml.ns._public.common.common_3.*;<br>
                        import javax.xml.namespace.QName;<br>
                        import com.evolveum.midpoint.prism.path.ItemPath;<br>
                        import com.evolveum.midpoint.schema.constants.SchemaConstants;<br>
                        import com.evolveum.midpoint.util.exception.ConfigurationException;<br>
                        import com.evolveum.midpoint.schema.util.ShadowUtil;<br>
<br>
                        //log.info("----------------------------- Entering in the  SynchronizationSorter ----------------")<br>
                       discriminator = new ObjectSynchronizationDiscriminatorType()<br>
<br>
                        discriminator.setKind(ShadowKindType.ACCOUNT)<br>
                        discriminator.setIntent("default")<br>
<br>
                        //log.info("----------------------------- Leaving the SynchronizationSorter ----------------")<br>
                        return discriminator<br>
                    </code><br>
                </script><br>
            </expression><br>
        </objectSynchronizationSorter><br>
<br>
        <objectSynchronization><br>
            <name>account</name><br>
            <objectClass>ri:AccountObjectClass</objectClass><br>
            <kind>account</kind><br>
            <intent>default</intent><br>
            <focusType>UserType</focusType><br>
            <enabled>true</enabled><br>
<br>
            <correlation><br>
                <q:or><br>
                    <q:equal><br>
                        <q:matching>stringIgnoreCase</q:matching><br>
                        <q:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">c:employeeNumber</q:path><br>
                        <expression><br>
                            <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:ScriptExpressionEvaluatorType"><br>
                                <code><br>
                                    def employeeId = basic.getAttributeValue(shadow, 'EmployeeId')<br>
                                    if(employeeId != null){<br>
                                        employeeId = employeeId.toString().trim()<br>
                                        log.info("EmployeeID: {}",employeeId)<br>
                                        log.info("EmployeeID length: {}",employeeId.length())<br>
                                        if(employeeId.length() != 6){<br>
                                            int count = 6 - employeeId.length()<br>
                                            int i = 0<br>
                                            if(count > 0){<br>
                                                boolean condition = count > i;<br>
                                                while(condition){<br>
                                                    employeeId = "0"+employeeId;<br>
                                                    i++;<br>
                                                    condition = count > i;<br>
                                                }<br>
                                            }<br>
                                        }<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The employeeId is {}",employeeId)<br>
                                        return employeeId<br>
                                    }else{<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The employeeId attribute is empty")<br>
                                        return "randomEmployeeIdDontExist"<br>
                                    }<br>
                                </code><br>
                            </script><br>
                        </expression><br>
                    </q:equal><br>
                    <q:equal><br>
                        <q:matching>stringIgnoreCase</q:matching><br>
                        <q:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">c:extension/emailAlias</q:path><br>
                        <expression><br>
                            <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:ScriptExpressionEvaluatorType"><br>
                                <code><br>
                                    def aliases = basic.getAttributeValues(shadow, 'Aliases')<br>
                                    if(aliases != null){<br>
<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The aliases is {}",aliases)<br>
                                        return aliases<br>
                                    }else{<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The aliases attribute is empty")<br>
                                        return "randomAliasesIdDontExist"<br>
                                    }<br>
                                </code><br>
                            </script><br>
                        </expression><br>
                    </q:equal><br>
                    <q:equal><br>
                        <q:matching>stringIgnoreCase</q:matching><br>
                        <q:path xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3">c:emailAddress</q:path><br>
                        <expression><br>
                            <script xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:c="http://midpoint.evolveum.com/xml/ns/public/common/common-3" xsi:type="c:ScriptExpressionEvaluatorType"><br>
                                <code><br>
                                    def aliases = basic.getAttributeValues(shadow, 'Aliases')<br>
                                    if(aliases != null){<br>
<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The aliases is {}",aliases)<br>
                                        return aliases<br>
                                    }else{<br>
                                        log.info("[CSO][AAD Corporate]{Correlation} The aliases attribute is empty")<br>
                                        return "randomAliasesIdDontExist"<br>
                                    }<br>
                                </code><br>
                            </script><br>
                        </expression><br>
                    </q:equal><br>
<br>
                </q:or><br>
            </correlation><br>
<br>
            <reaction><br>
                <situation>linked</situation><br>
                <synchronize>true</synchronize><br>
            </reaction><br>
            <reaction><br>
                <situation>deleted</situation><br>
            </reaction><br>
            <reaction><br>
                <situation>unlinked</situation><br>
                <synchronize>true</synchronize><br>
                <action><br>
                    <handlerUri>http://midpoint.evolveum.com/xml/ns/public/model/action-3#link</handlerUri><br>
                </action><br>
            </reaction><br>
            <reaction><br>
                <situation>unmatched</situation><br>
            </reaction><br>
        </objectSynchronization><br>
<br>
    </synchronization><br>
<br>
    <caching><br>
        <cachingStategy>passive</cachingStategy><br>
    </caching><br>
<br>
    <capabilities><br>
        <configured><br>
            <cap:activation><br>
                <cap:status><br>
                    <cap:attribute>ri:AccountEnabled</cap:attribute><br>
                    <cap:enableValue>True</cap:enableValue><br>
                    <cap:disableValue>False</cap:disableValue><br>
                </cap:status><br>
            </cap:activation><br>
            <cap:create><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:create><br>
            <cap:update><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:update><br>
            <cap:delete><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:delete><br>
            <cap:credentials><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:credentials><br>
            <cap:liveSync><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:liveSync><br>
            <cap:script><br>
                <cap:enabled>false</cap:enabled><br>
            </cap:script><br>
        </configured><br>
    </capabilities><br>
<br>
<br>
<br>
<br>
<br>
</resource></span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color:#4472C4"> </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color:#4472C4"> </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color:#4472C4">Regards,</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="color:#4472C4"> </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<b><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4">Santiago Sañudo Martínez</span></b></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4">Cloud Security Operations
</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4">Plaza de Manuel Llano, Santander, Spain, 39011</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4"> </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span lang="EN-GB" style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4"><img width="144" height="31" id="x_Picture_x0020_2" style="width:1.5in; height:.3229in" data-outlook-trace="F:1|T:1" src="cid:image001.jpg@01D81120.37EDD9F0"></span><span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4"></span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4"><a href="http://bit.ly/IngramTwitter"><span style="color:#4472C4">Twitter</span></a> | <a href="http://bit.ly/IngramLinkedIN"><span style="color:#4472C4">LinkedIn</span></a> | <a href="http://bit.ly/IngramFacebook"><span style="color:#4472C4">Facebook</span></a> | <a href="http://bit.ly/IngramYouTube"><span style="color:#4472C4">YouTube</span></a>  </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4"> </span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
<span style="font-size:10.0pt; font-family:"Arial",sans-serif; color:#4472C4">This email may contain material that is confidential, and proprietary to Ingram Micro and subsidiaries, for the sole use of the intended recipient. Any review, reliance or distribution
 by others or forwarding without express permission is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.</span></p>
<p class="x_MsoNormal" style="margin: 0in; font-size: 11pt; font-family: Calibri, sans-serif;">
 </p>
</div>
<p><span style="font-family:Calibri; font-size:xx-small"><br>
La información contenida en este mensaje es confidencial. En caso de que reciba este mensaje por error le rogamos lo comunique a la mayor brevedad al emisor y proceda a su eliminación definitiva, absteniéndose de copiar, almacenar o difundir su contenido. De
 acuerdo con lo establecido en la Ley Orgánica 15/1999, de Protección de Datos de Carácter Personal y en el Reglamento de Desarrollo 1720/2007, los datos personales que facilite a través de la dirección de correo indicada serán incorporados a un fichero titularidad
 de INGRAM MICRO, S.L.U., con domicilio en C/ Antonio Machado, 78-80 1ª y 2ª pl. Business Park ( 08840-Viladecans). Mediante el envío de sus datos, Ud. otorga su consentimiento expreso a INGRAM MICRO, S.L.U, para el tratamiento de sus datos, con la finalidad
 de atender a su consulta y/o mantener la relación profesional, comercial, y/o contractual que en su caso establezca con INGRAM MICRO, S.L.U. Puede ejercitar sus derechos de acceso, rectificación, cancelación y oposición notificándolo por escrito a la dirección
 del remitente, o a la siguiente dirección de correo nuevascuentas@ingrammicro.es. De acuerdo con la Ley 34/2002, de Servicios de la Sociedad de la Información y de Comercio Electrónico, Vd. podrá oponerse en cualquier momento al tratamiento de sus datos con
 fines promocionales notificándonoslo por escrito a la dirección de correo mencionada.<br>
.................................................................................................................................................................................................................................................<br>
The information contained in this message is confidential. If you receive this message by error please notify it as soon as possible to the sender and proceed to their final elimination by not copy, store or distribute its content. In accordance of what is
 stated in the Law 15/1999, of Data Personal Protection and Regulation Rule 1720/2007, the personal data provided through the email address you entered will be included in a file owned by INGRAM MICRO, SLU, located at C/ Antonio Machado, 78-80 1ª y 2ª pl. Business
 Park ( 08840-Viladecans). By submitting your data, you expressly give your consent to INGRAM MICRO, SLU, to the treatment of your data, in order to answer to your questions and / or keep the professional, commercial relationship  and / or contractual set with
 INGRAM MICRO, SLU You can exercise your rights of access, rectification, cancellation and opposition by giving written notification to the sender address or to  the following email:  nuevascuentas@ingrammicro.es. According to Law 34/2002, of the Information
 Society and Electronic Commerce, you may object at any time to your data treatment for promotional purposes by notifying us in writing to the email address above.<br>
<span style="color:#ffffff">[Ingram_2818e5de]</span></span></p>
</div>
</div>
</body>
</html>