<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><div>Hello Ivan,</div><div><br></div><div>Thank you for your quick response. I will try this tomorrow on my solution, it looks like it could work. Other mappings from my template are working, so it's just this conditional that is giving me trouble. I set the organization attribute when I create focus users in midpoint via the Web Service Interface and it seems to be map correctly. It's just this one that was bugging me.</div><div><br></div><div>BR.</div><div>Samu<br><br></div><div><hr id="stopSpelling">To: midpoint@lists.evolveum.com<br>From: ivan.noris@evolveum.com<br>Date: Tue, 24 Nov 2015 16:28:19 +0100<br>Subject: Re: [midPoint] Conditional Assignments<br><br>
  
    
  
  
    Hi Samu,<br>
    <br>
    although I'm not assigning resource account but a role instead, this
    is my working code:<br>
    <br>
       <mapping><br>
            <name>My Object Template: Assign Role XYZ</name><br>
            <authoritative>true</authoritative><br>
            <source><br>
                    <path>$user/employeeType</path><br>
            </source><br>
            <expression><br>
                    <assignmentTargetSearch><br>
                           
    <targetType>c:RoleType</targetType><br>
                           
    <oid>00000000-dc00-dc00-0004-000000000077</oid><br>
                    </assignmentTargetSearch><br>
            </expression><br>
            <target><br>
                    <path>assignment</path><br>
            </target><br>
            <condition><br>
                    <script><br>
                        <code>employeeType ==
    'employee'</code><br>
                    </script>  <br>
            </condition><br>
        </mapping><br>
    <br>
    Could you please the construction from the above - for your case
    probably you need to change c:RoleType to c:ResourceType...<br>
    <br>
    Some other questions:<br>
    1) are other mappings from the same object template working? (To
    avoid problem of not using template at all...)<br>
    2) how is the attribute organization set in your scenario?<br>
    <br>
    Best regards,<br>
    Ivan<br>
    <br>
    <div class="ecxmoz-cite-prefix">On 11/24/2015 04:06 PM, Samu Viitanen
      wrote:<br>
    </div>
    <blockquote cite="mid:DUB117-W10578FA5434E5A9AA301A92D1060@phx.gbl">
      <style><!--
.ExternalClass .ecxhmmessage P {
padding:0px;
}

.ExternalClass body.ecxhmmessage {
font-size:12pt;
font-family:Calibri;
}

--></style>
      <div dir="ltr">Hello,<br>
        <br>
        I am having trouble finding a solution on how to create
        conditional assignments in an Object Template. I have an Object
        Template and I would like to see if the Focus user's attribute
        "organization" matches to a specific string before creating my
        assignment. See mapping below<br>
        <br>
           <mapping><br>
              <source><br>
                 <c:path>organization</c:path><br>
              </source><br>
              <expression><br>
                 <value><br>
                    <targetRef oid="resource-oid-123-456"
        type="c:ResourceType"/><br>
                 </value><br>
              </expression><br>
              <target><br>
                 <c:path>assignment</c:path><br>
              </target><br>
              <condition><br>
                 <script><br>
                    <description><br>
                        Create a condition to see that the organization
        matches<br>
                    </description><br>
                    <code>organization == 'org'</code><br>
                 </script><br>
              </condition><br>
           </mapping><br>
        <br>
        This is the point where I am stuck. I figured that the example
        above is somewhat correct, but the condition is still never true
        even though I know my focus user's organization is 'org'. I am
        not very familiar with expressions and conditions yet. I tried
        to find the answer in Wiki, but didn't find a related example. I
        also looked into the live demo's Object Template, where a
        similar thing is done, but it did not help me here.<br>
        <br>
        Best Regards<br>
        Samu Viitanen<br>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
midPoint mailing list
<a class="ecxmoz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="ecxmoz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
    <pre class="ecxmoz-signature">-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer & IDM Architect
  evolveum.com                     evolveum.com/blog/
  ___________________________________________________
  "Semper Id(e)M Vix."
</pre>
  

<br>_______________________________________________
midPoint mailing list
midPoint@lists.evolveum.com
http://lists.evolveum.com/mailman/listinfo/midpoint</div>                                           </div></body>
</html>