[midPoint] inbound that returns only the first entry from a list

Hsin-Fang Hsu hsin-fang.hsu at itconcepts.ch
Fri Jul 22 14:34:22 CEST 2022


Hi Pálos,

This is exactly what I want! Thanks a lot!!

Best regards,
Hsin-Fang

From: Pálos Gustáv <gustav.palos at gmail.com>
Sent: Friday, July 22, 2022 1:21 PM
To: midPoint General Discussion <midpoint at lists.evolveum.com>
Cc: Hsin-Fang Hsu <hsin-fang.hsu at itconcepts.ch>; Fabian Noll-Dukiewicz <fabian.noll-dukiewicz at fndit.de>
Subject: Re: [midPoint] inbound that returns only the first entry from a list

or use

<relativityMode>absolute</relativityMode>
to get all values in input param and fetch first one over input?.get(0)

best regards,

Gustav
pi 22. 7. 2022 o 13:08 Fabian Noll-Dukiewicz via midPoint <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>> napísal(a):
Hi,

you can tokenize your input (inArr = input.tokenize(',') to create an array. After that you can loop through your values or  just return the first one (return inArr[0]).

Hope that helps.

Kind regards,
Fabian

Von: Hsin-Fang Hsu <hsin-fang.hsu at itconcepts.ch<mailto:hsin-fang.hsu at itconcepts.ch>>
Datum: Freitag, 22. Juli 2022 um 10:52
An: midPoint General Discussion <midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>>
Betreff: [midPoint] inbound that returns only the first entry from a list
Hi,

In the resource, the attribute ri:mail is a list. In the inbound, I just want to take the first entry in the mail list and target it to emailAddress.
How can I do this?

The code below simply results in the error: Attempt to add 2 values to a single-valued item emailAddress
The input of the inbound attribute is always just one value instead of a list, so I cannot check if the input is a list.

<attribute>
    <ref>ri:mail</ref>
    <inbound>
        <expression>
            <script>
                <code>
                    log.info<http://log.info>("--input is:"+input)
                    return input
                </code>
            </script>
        </expression>
        <target>
            <path>emailAddress</path>
        </target>
    </inbound>
</attribute>


Thank you very much for your help in advance!

Best regards,
Hsin-Fang
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
https://lists.evolveum.com/mailman/listinfo/midpoint


--
s pozdravom

Gustáv Pálos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20220722/8d3b8189/attachment-0001.htm>


More information about the midPoint mailing list