<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style>
</head>
<body lang="EN-US" link="blue" vlink="purple" style="word-wrap:break-word">
<div class="WordSection1">
<p class="MsoNormal">Thanks Paul! <o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">That worked, and got me to find the section of the Query API documentation about special symbols in item paths.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">Jan<o:p></o:p></p>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal" style="margin-bottom:12.0pt"><b><span style="font-size:12.0pt;color:black">From:
</span></b><span style="font-size:12.0pt;color:black">Paul Engle <pengle@rice.edu><br>
<b>Date: </b>Thursday, September 23, 2021 at 10:09 AM<br>
<b>To: </b>midPoint General Discussion <midpoint@lists.evolveum.com><br>
<b>Cc: </b>Tax, Jan <tax@unc.edu><br>
<b>Subject: </b>Re: [midPoint] Org assignment query help<o:p></o:p></span></p>
</div>
<div>
<p class="MsoNormal">You can use the @ symbol in a path name to dereference something and<br>
get to the attributes of the referenced object. So, in your original<br>
query, you can replace the inner filter with something like:<br>
<br>
<q:filter><br>
  <q:equal><br>
    <q:path>c:targetRef/@/name</q:path><br>
    <q:value>foo</q:value><br>
  </q:equal><br>
</q:filter><br>
<br>
to get the members of an Org named 'foo'.<br>
<br>
-- <br>
Paul Engle<br>
IAM Architect<br>
Identity & Access Management<br>
pengle@rice.edu 713-348-4702<br>
<br>
On Wed, Sep 22, 2021 at 8:25 AM Tax, Jan via midPoint<br>
<midpoint@lists.evolveum.com> wrote:<br>
><br>
><br>
><br>
> Hello,<br>
><br>
><br>
><br>
> I am trying to put together a scripted task that sends a notification email to each member of an org. The task performs correctly when I use the OID to specify the group, but since OIDs for orgs are generated when the org is created, I would like to reference
 the org by name. I can’t seem to get that to work.<br>
><br>
><br>
><br>
> I have been using the Query Playground to test the queries. Here is a query that uses OID:<br>
><br>
><br>
><br>
> <q:QueryType xmlns:q="<a href="http://prism.evolveum.com/xml/ns/public/query-3">http://prism.evolveum.com/xml/ns/public/query-3</a>" xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"
 xmlns:icfs="<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3</a>" xmlns:org="<a href="http://midpoint.evolveum.com/xml/ns/public/common/org-3">http://midpoint.evolveum.com/xml/ns/public/common/org-3</a>"
 xmlns:ri="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>" xmlns:t="<a href="http://prism.evolveum.com/xml/ns/public/types-3">http://prism.evolveum.com/xml/ns/public/types-3</a>"
 xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="q:QueryType"><br>
><br>
>     <q:filter><br>
><br>
>         <q:type><br>
><br>
>             <q:type>c:UserType</q:type><br>
><br>
>             <q:filter><br>
><br>
>                 <q:exists><br>
><br>
>                     <q:path>c:assignment</q:path><br>
><br>
>                     <q:filter><br>
><br>
>                         <q:ref><br>
><br>
>                             <q:path>c:targetRef</q:path><br>
><br>
>                             <q:value oid="473aa64d-3940-46da-b54b-43a0292c592b" relation="q:any" type="c:OrgType" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="c:ObjectReferenceType"><br>
><br>
>                            </q:value><br>
><br>
>                         </q:ref><br>
><br>
>                     </q:filter><br>
><br>
>                 </q:exists><br>
><br>
>             </q:filter><br>
><br>
>         </q:type><br>
><br>
>     </q:filter><br>
><br>
> </q:QueryType><br>
><br>
><br>
><br>
> It returns four people assigned to my test org.<br>
><br>
><br>
><br>
> My attempt to reference the org by name :<br>
><br>
><br>
><br>
> <q:QueryType xmlns:q="<a href="http://prism.evolveum.com/xml/ns/public/query-3">http://prism.evolveum.com/xml/ns/public/query-3</a>" xmlns:c="<a href="http://midpoint.evolveum.com/xml/ns/public/common/common-3">http://midpoint.evolveum.com/xml/ns/public/common/common-3</a>"
 xmlns:icfs="<a href="http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3">http://midpoint.evolveum.com/xml/ns/public/connector/icf-1/resource-schema-3</a>" xmlns:org="<a href="http://midpoint.evolveum.com/xml/ns/public/common/org-3">http://midpoint.evolveum.com/xml/ns/public/common/org-3</a>"
 xmlns:ri="<a href="http://midpoint.evolveum.com/xml/ns/public/resource/instance-3">http://midpoint.evolveum.com/xml/ns/public/resource/instance-3</a>" xmlns:t="<a href="http://prism.evolveum.com/xml/ns/public/types-3">http://prism.evolveum.com/xml/ns/public/types-3</a>"
 xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="q:QueryType"><br>
><br>
>     <q:filter><br>
><br>
>         <q:type><br>
><br>
>             <q:type>c:UserType</q:type><br>
><br>
>             <q:filter><br>
><br>
>                 <q:exists><br>
><br>
>                     <q:path>c:assignment</q:path><br>
><br>
>                     <q:filter><br>
><br>
>                         <q:ref><br>
><br>
>                             <q:path>c:targetRef</q:path><br>
><br>
>                             <q:value relation="q:any" type="c:OrgType" xmlns:xsi="<a href="http://www.w3.org/2001/XMLSchema-instance">http://www.w3.org/2001/XMLSchema-instance</a>" xsi:type="c:ObjectReferenceType"><br>
><br>
>     <q:filter><br>
><br>
>         <q:type><br>
><br>
>             <q:type>c:ObjectReferenceType</q:type><br>
><br>
>             <q:filter><br>
><br>
>                 <q:equal><br>
><br>
>                     <q:path>c:name</q:path><br>
><br>
>                     <q:value>test-org</q:value><br>
><br>
>                 </q:equal><br>
><br>
>             </q:filter><br>
><br>
>         </q:type><br>
><br>
>     </q:filter><br>
><br>
>                             </q:value><br>
><br>
>                         </q:ref><br>
><br>
>                     </q:filter><br>
><br>
>                 </q:exists><br>
><br>
>             </q:filter><br>
><br>
>         </q:type><br>
><br>
>     </q:filter><br>
><br>
> </q:QueryType><br>
><br>
><br>
><br>
> The inner query to find the org works correctly, but when I put in in the context of the assignment query, it returns people assigned to all orgs, not just the one org I have specified.<br>
><br>
><br>
><br>
> Any guidance is appreciated.<br>
><br>
><br>
><br>
> Jan<br>
><br>
> --<br>
><br>
> Johannes (Jan) Tax<br>
><br>
> ITS Identity Management<br>
><br>
> University of North Carolina at Chapel Hill<br>
><br>
> +1 919 962 5642<br>
><br>
><br>
><br>
><br>
><br>
><br>
><br>
> _______________________________________________<br>
> midPoint mailing list<br>
> midPoint@lists.evolveum.com<br>
> <a href="https://lists.evolveum.com/mailman/listinfo/midpoint">https://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></p>
</div>
</div>
</body>
</html>