<div dir="ltr">Just to clarify, make sure "attr" variable contains a <b>string </b>with the attribute you want to get. That's how we have it configured in our own implementations and it's working fine.<div>Also, perhaps add some logging to see the contents of the "attributes" array:</div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><i>attributes.each{attr, value -> <a href="http://log.info">log.info</a>("Attribute received: ${attr} -> ${value}")};</i></blockquote><div>So you get a better grasp of what's on that array.</div><div><br></div><div>Regards, <br></div></div><div class="gmail_extra"><br clear="all"><div><div class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><font face="arial, helvetica, sans-serif"><b>Rodrigo Yanis.</b><br><img src="http://www.identicum.com/img/favicon.ico">Identicum S.A.<br></font>Jorge Newbery 3226<br>Tel: +54 (11) 4552-3050<font face="arial, helvetica, sans-serif"><br><a href="mailto:ryanis@identicum.com" target="_blank"><font color="#0b5394">ryanis@identicum.com</font></a><br><a href="http://www.identicum.com/" target="_blank"><font color="#0b5394">www.identicum.com</font></a></font></div></div></div></div></div></div></div></div></div></div></div></div></div>
<br><div class="gmail_quote">2017-07-06 13:05 GMT-03:00 Rodrigo Yanis <span dir="ltr"><<a href="mailto:ryanis@identicum.com" target="_blank">ryanis@identicum.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hello Wojciech,<div><br></div><div>Have you tried something like this?</div><div><br></div><div><i>attributes?.get("<span style="font-size:12.8px">n_family</span>")?.<wbr>get(0);</i><br></div><div><i><br></i></div><div>Regards,</div></div><div class="gmail_extra"><br clear="all"><div><div class="m_1513202855988744453gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><br></div><div dir="ltr"><font face="arial, helvetica, sans-serif"><b>Rodrigo Yanis.</b><br><img src="http://www.identicum.com/img/favicon.ico">Identicum S.A.<br></font>Jorge Newbery 3226<br>Tel: +54 (11) 4552-3050<font face="arial, helvetica, sans-serif"><br><a href="mailto:ryanis@identicum.com" target="_blank"><font color="#0b5394">ryanis@identicum.com</font></a><br><a href="http://www.identicum.com/" target="_blank"><font color="#0b5394">www.identicum.com</font></a></font></div></div></div></div></div></div></div></div></div></div></div></div></div><div><div class="h5">
<br><div class="gmail_quote">2017-07-06 12:23 GMT-03:00 Wojciech Staszewski <span dir="ltr"><<a href="mailto:wojciech.staszewski@diagnostyka.pl" target="_blank">wojciech.staszewski@<wbr>diagnostyka.pl</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hello!<br>
<br>
I have a resource with ScriptedSQL 1.1.2.0-em3 connector.<br>
<br>
It worked ok, but from a certain date it gives me an error during attibutes update:<br>
<br>
switch ( action ) {<br>
<br>
    case "UPDATE":<br>
    switch ( objectClass ) {<br>
        case "__ACCOUNT__":<br>
        for (attr in accountAttrNames) {<br>
            if (attributes.get(attr) != null) {<br>
                switch (attr) {<br>
                    case "n_family":<br>
                        def family = attributes.get(attr)?.get(0).t<wbr>oString();<br>
                        sql.executeUpdate("UPDATE egw_addressbook SET n_family=? WHERE account_id=?",[family,uid]);<br>
                        break;<br>
                        [...]<br>
<br>
<br>
<br>
<br>
Outbound mapping:<br>
<br>
<attribute><br>
<c:ref>ri:n_family</c:ref><br>
<outbound><br>
               <authoritative>true</authorit<wbr>ative><br>
               <exclusive>false</exclusive><br>
               <strength>normal</strength><br>
               <source><br>
                  <c:path>familyName</c:path><br>
               </source><br>
</outbound><br>
</attribute><br>
<br>
<br>
<br>
The ERROR:<br>
ERROR (com.evolveum.midpoint.provisi<wbr>oning.ucf.impl.connid.ConnIdUt<wbr>il): ConnId Exception java.lang.IndexOutOfBoundsExce<wbr>ption in connector:97d430f1-d2b0-4487-b<wbr>60b-4905dc76d2ca(ICF org.forgerock.openicf.connecto<wbr>rs.scriptedsql.ScriptedSQLConn<wbr>ector v1.1.2.0.em3): ConnectorSpec(resource:d7a1b38<wbr>c-07db-42cc-b173-664b6e317871(<wbr>EGroupWare), name=null, oid=97d430f1-d2b0-4487-b60b-49<wbr>05dc76d2ca) while updating object identified by ConnId UID '1020': Index: 0, Size: 0<br>
ERROR (com.evolveum.midpoint.provisi<wbr>oning.impl.ProvisioningService<wbr>Impl): Couldn't modify object: unexpected problem: java.lang.IndexOutOfBoundsExce<wbr>ption: Index: 0, Size: 0<br>
ERROR (com.evolveum.midpoint.model.i<wbr>mpl.lens.ChangeExecutor): Error executing changes for (account (default) on resource:d7a1b38c-07db-42cc-b1<wbr>73-664b6e317871(EGroupWare)): Internal error: java.lang.IndexOutOfBoundsExce<wbr>ption: Index: 0, Size: 0<br>
<br>
The value of "n_family" is NULL, although "familyName" of midPoint's user is not null.<br>
<br>
I tried this (sorry, I'm not a developer):<br>
<br>
def family = attributes.get(attr)?.get(0).t<wbr>oString();<br>
def family = attributes?.get(attr)?.get(0).<wbr>toString();<br>
def family = attributes.get(attr)?.get(0);<br>
def family = attributes?.get(attr)?.get(0);<br>
def family = attributes.get(attr)?.find { true };<br>
<br>
as in the example: <a href="https://github.com/Evolveum/midpoint/blob/master/samples/resources/scriptedsql/CreateScript.groovy" rel="noreferrer" target="_blank">https://github.com/Evolveum/mi<wbr>dpoint/blob/master/samples/res<wbr>ources/scriptedsql/CreateScrip<wbr>t.groovy</a><br>
<br>
all with the same result, that means NULL. What is the correct working syntax?<br>
<br>
Thanks a lot,<br>
Regards,<br>
Wojciech Staszewski.<br>
______________________________<wbr>_________________<br>
midPoint mailing list<br>
<a href="mailto:midPoint@lists.evolveum.com" target="_blank">midPoint@lists.evolveum.com</a><br>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" rel="noreferrer" target="_blank">http://lists.evolveum.com/mail<wbr>man/listinfo/midpoint</a><br>
</blockquote></div><br></div></div></div>
</blockquote></div><br></div>