<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <div class="moz-cite-prefix">Hi,<br>
      <br>
      We have done similar things using the iteration feature:
      <a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/Unique+Account+Username+HOWTO">https://wiki.evolveum.com/display/midPoint/Unique+Account+Username+HOWTO</a><br>
      <br>
      There are preIterationCondition and postIterationCondition that
      might be used exactly as you want to (see the wiki page). However,
      I'm not sure if this is executed only when the value changes. You
      have try it.<br>
      <br>
      The question about alert popup is a bit tricky. The mappings are
      not always executed as synchronous GUI-driven tasks. E.g. there is
      live sync or scheduled reconciliation. So it is not directly
      possible to display any kind of alert. However, we have the
      OperationResult structure
      (<a class="moz-txt-link-freetext" href="https://wiki.evolveum.com/display/midPoint/OperationResult">https://wiki.evolveum.com/display/midPoint/OperationResult</a>) that
      is designed to maintain complex state of all operations. If an
      error or warning is added to the operation result then it will be
      displayed in the GUI and it will eventually find its way into the
      task result, etc. So this is the right way to do it.
      OperationResult is currently not directly available to the
      mapping. But throwing an error from the mapping will be recorded
      in the parent operation result. If you are thinking about a
      warning, that should be possible too. Perhaps the best way would
      be to create a new method for this. It should not be difficult.
      Let me know if you need that.<br>
      <br>
      <pre class="moz-signature" cols="72">-- 
Radovan Semancik
Software Architect
evolveum.com
</pre>
      <br>
      <br>
      On 04/12/2016 10:44 AM, Pavol Mederly wrote:<br>
    </div>
    <blockquote cite="mid:570CB55C.403@gmail.com" type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      Hello Roman,<br>
      <br>
      thank you for the explanation; now I think I understand :)<br>
      <br>
      The information you are looking for is in
      ExpressionEvaluationContext instance. However, I don't see any
      clean way of obtaining that object as of now. (It would be easy to
      add a ThreadLocal holding it, but currently it isn't there.)<br>
      <br>
      An alternative, and quite ugly, way would be to obtain LensContext
      and analyze primary and secondary deltas stored there. You can
      access it like this:<br>
      <br>
      LensContext ctx =
com.evolveum.midpoint.model.impl.expr.ModelExpressionThreadLocalHolder.getLensContext();<br>
      <br>
      and then analyze e.g. ctx.focusContext.primaryDelta /
      ctx.focusContext.secondaryDelta to see if there's a change on
      currentADDisplayName ... but it is really dirty.<br>
      <br>
      Maybe someone (Radovan?) could provide a better way. Or maybe we
      could implement this feature in the future.<br>
      <br>
      Best regards,<br>
      Pavol<br>
      <br>
      <div class="moz-cite-prefix">On 12.04.2016 10:10, Roman Pudil -
        AMI Praha a.s. wrote:<br>
      </div>
      <blockquote
        cite="mid:em948aec7a-9358-4120-bd45-54f0d26efa7b@rpudil-dell7440"
        type="cite">
        <style id="eMClientCss">BLOCKQUOTE.cite {
        PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px
}
BLOCKQUOTE.cite2 {
        MARGIN-TOP: 3px; PADDING-TOP: 0px; PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px
}
.plain PRE {
        FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal
}
.plain TT {
        FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal
}
A IMG {
        BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px
}
#x454486c7b152426fba41c2731bf5606a #x4896a918a79743079569d047d86973a0 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
#x4896a918a79743079569d047d86973a0 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
#x68e8301635364e4c93d0741d1b01b973 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
#x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
#x895827aeab1f42bbbaa6e68de2a7647b #x4896a918a79743079569d047d86973a0 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
#xb91cc98f19b044e98423450ae345ebd7 {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
.plain PRE {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
.plain TT {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
BODY {
        FONT-SIZE: 12pt; FONT-FAMILY: Tahoma
}
</style>
        <style>#x68e8301635364e4c93d0741d1b01b973 BLOCKQUOTE.cite2
{MARGIN-TOP: 3px; PADDING-TOP: 0px; PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px}
#x68e8301635364e4c93d0741d1b01b973 .plain PRE, #x68e8301635364e4c93d0741d1b01b973 .plain TT
{FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal}
#x68e8301635364e4c93d0741d1b01b973 A IMG
{BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px}
#x68e8301635364e4c93d0741d1b01b973 #xb91cc98f19b044e98423450ae345ebd7, #x68e8301635364e4c93d0741d1b01b973 .plain PRE, #x68e8301635364e4c93d0741d1b01b973 .plain TT, #x68e8301635364e4c93d0741d1b01b973
{FONT-SIZE: 12pt; FONT-FAMILY: Tahoma}
#x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 BLOCKQUOTE.cite2, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf BLOCKQUOTE.cite2
{MARGIN-TOP: 3px; PADDING-TOP: 0px; PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px}
#x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain PRE, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain TT, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf .plain PRE, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf .plain TT
{FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal}
#x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 A IMG, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf A IMG
{BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px}
#x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain PRE, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain TT, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf .plain PRE, #x68e8301635364e4c93d0741d1b01b973 #x2cc747d0139c451cbb53860f8b96fdaf .plain TT
{FONT-SIZE: 12pt; FONT-FAMILY: Tahoma}
</style>
        <div>Hi Pavol,</div>
        <div>I am sorry.</div>
        <div> </div>
        <div>Goal: If attribute <span
            id="x895827aeab1f42bbbaa6e68de2a7647b"
            style="BACKGROUND-COLOR: #ffffff"><span
              id="x4896a918a79743079569d047d86973a0"
              style="BACKGROUND-COLOR: #ffffff">$user/extension/currentADDisplayName</span></span>
          is changed, then search user with the same <span
            id="x454486c7b152426fba41c2731bf5606a"
            style="BACKGROUND-COLOR: #ffffff"><span
              id="x4896a918a79743079569d047d86973a0"
              style="BACKGROUND-COLOR: #ffffff">currentADDisplayName
              attribute value - only with new value, not with
              old/removed value </span></span>(duplicity); If found,
          then throw exeption, else save new value.</div>
        <div> </div>
        <div>Problem: This code is always performed, even if the
          attribute <span id="x4896a918a79743079569d047d86973a0"
            style="BACKGROUND-COLOR: #ffffff">$user/extension/currentADDisplayName</span>
          does not change.</div>
        <div> </div>
        <div>My suggestion: Check, if <span
            id="xf9a9252b540a477e86f53f1d04903120"
            style="BACKGROUND-COLOR: #ffffff">$user/extension/currentADDisplayName

            currently changing. It is OK?</span></div>
        <div><span style="BACKGROUND-COLOR: #ffffff"></span> </div>
        <div><span style="BACKGROUND-COLOR: #ffffff">PS: It is some way
            to show some "alert window" in groovy similar to javascript
            alert window?</span></div>
        <div> </div>
        <div>     <mapping><br>
                <name>AD Display Name</name><br>
                <strength>normal</strength><br>
                <source><br>
                   <c:path>$user/name</c:path><br>
                </source><br>
                <source><br>
                  
          <c:path>$user/extension/currentADDisplayName</c:path><br>
                </source><br>
                <expression><br>
                   <script><br>
                    
          <relativityMode>relative</relativityMode><br>
                    
          <language><a moz-do-not-send="true"
            class="moz-txt-link-freetext"
href="http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy">http://midpoint.evolveum.com/xml/ns/public/expression/language#Groovy</a></language><br>
                      <code><br>
                      import java.text.Normalizer;<br>
                      import javax.xml.namespace.QName;<br>
                      import
          com.evolveum.midpoint.prism.query.ObjectQuery;<br>
                      import
          com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowKindType;<br>
                      import
          com.evolveum.midpoint.xml.ns._public.common.common_3.UserType;<br>
                      import
          com.evolveum.midpoint.prism.query.EqualFilter;<br>
                      import
          com.evolveum.midpoint.prism.query.AndFilter;<br>
                      import
          com.evolveum.midpoint.prism.query.NotFilter;<br>
                      import com.evolveum.midpoint.prism.path.ItemPath;<br>
                      import com.evolveum.midpoint.prism.PrismConstants;<br>
                      import
          com.evolveum.midpoint.xml.ns._public.common.common_3.FocusType;<br>
                      import
          com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType;<br>
                      import
          com.evolveum.prism.xml.ns._public.types_3.PolyStringType;<br>
                      import
          com.evolveum.prism.xml.ns._public.types_3.ObjectReferenceType;<br>
                      import
          com.evolveum.midpoint.schema.SelectorOptions;<br>
                      import
          com.evolveum.midpoint.schema.GetOperationOptions;<br>
                      import
          com.evolveum.midpoint.model.api.PolicyViolationException;<br>
                      import
          com.evolveum.midpoint.prism.polystring.PolyString;<br>
                      <br>
                      // vyhledat duplicitu na currentADDisplayName<br>
                      // ------------ needs to be edited
          -----------------<br>
                      searchAttrName = "currentADDisplayName";     //
          name of attribute to search<br>
                      searchAttrValue = currentADDisplayName;      //
          value of attribute to search (filled from definition in
          "source" path above)<br>
                      searchAttrUserName = "name";     // name of
          attribute to search<br>
                      searchAttrUserValue = name;      // value of
          attribute to search (filled from definition in "source" path
          above)<br>
                      // ------------ needs to be edited (END)
          -----------------    <br>
                      <br>
                      boolean isNew =
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluationContext.getThreadLocal().isEvaluateNew();</div>
        <div> </div>
        <div>            if (isNew &amp;&amp;
          !basic.isEmpty(searchAttrValue)) {<br>
                          def filters = [];          <br>
                         
          filters.add(NotFilter.createNot(EqualFilter.createEqual(new
          ItemPath(new QName(searchAttrUserName)),
          user.asPrismObject().getDefinition().findPropertyDefinition(new
          QName(searchAttrUserName)), null, searchAttrUserValue)));<br>
                          filters.add(EqualFilter.createEqual(new
          ItemPath(new ItemPath(PrismConstants.EXTENSION_LOCAL_NAME),
          new QName('<a moz-do-not-send="true"
            class="moz-txt-link-freetext"
            href="http://ami.cz/xml/ns/userExtension">http://ami.cz/xml/ns/userExtension</a>',
          searchAttrName)),
          user.asPrismObject().getExtension().getDefinition().findPropertyDefinition(new

          QName(searchAttrName)), null, new String(searchAttrValue)));<br>
                          filter = AndFilter.createAnd(filters);<br>
                          // use midPoint Library method "searchObjects"<br>
                          allUsers =
          midpoint.searchObjects(UserType.class,
          ObjectQuery.createObjectQuery(filter));<br>
                          if (allUsers.size() &gt; 0 ) {<br>
                             allUsers.each {<br>
                                  throw new
          com.evolveum.midpoint.model.api.PolicyViolationException('&gt;&gt;&gt;&gt;&gt;

          Duplicitní AD Display Name ' + currentADDisplayName + ', toto
          Display Name má již uživatel ' + it?.getName() + '.
          &lt;&lt;&lt;&lt;&lt;');<br>
                              }<br>
                          } else {<br>
                              return currentADDisplayName;<br>
                          }<br>
                      }<br>
                          </code><br>
                   </script><br>
                </expression><br>
                <target><br>
                  
          <c:path>$user/extension/currentADDisplayName</c:path><br>
                </target><br>
                <condition><br>
                  <script><br>
                     
<code>!basic.isEmpty(basic.stringify(currentADDisplayName))</code><br>
                  </script><br>
                </condition><br>
               
          <evaluationPhase>afterAssignments</evaluationPhase><br>
             </mapping><br>
        </div>
        <div> </div>
        <div> </div>
        <div> </div>
        <div>Regards</div>
        <div>Roman Pudil</div>
        <div> </div>
        <div> </div>
        <div> </div>
        <div id="signature_old">
          <div style="FONT-SIZE: 12pt; FONT-FAMILY: Tahoma">
            <table style="WHITE-SPACE: normal; WORD-SPACING: 0px;
              BORDER-COLLAPSE: collapse; TEXT-TRANSFORM: none; COLOR:
              rgb(0,0,0); FONT: medium 'Times New Roman'; WIDOWS: 1;
              LETTER-SPACING: normal; TEXT-INDENT: 0px;
              -webkit-text-stroke-width: 0px">
              <tbody>
                <tr>
                  <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                    sans-serif; VERTICAL-ALIGN: bottom; COLOR:
                    rgb(0,0,0)" colspan="2">
                    <p><span style="FONT-SIZE: 14px; FONT-WEIGHT: bold">Roman

                        Pudil</span><br>
                      solution architect<br>
                      <br>
                      gsm: [+420] 775 663 666<br>
                      e-mail:<span class="Apple-converted-space"> </span><a
                        moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="mailto:roman.pudil@ami.cz"><a class="moz-txt-link-abbreviated" href="mailto:roman.pudil@ami.cz">roman.pudil@ami.cz</a></a></p>
                  </td>
                  <td style="BORDER-RIGHT: rgb(204,204,204) 1px solid">   </td>
                  <td>   </td>
                  <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                    sans-serif; VERTICAL-ALIGN: bottom; COLOR:
                    rgb(0,0,0)">
                    <p>AMI Praha a.s.<br>
                      Pláničkova 11<br>
                      162 00 Praha 6<br>
                      tel./fax: [+420] 274 783 239<br>
                      web:<span class="Apple-converted-space"> </span><a
                        moz-do-not-send="true"
                        class="moz-txt-link-abbreviated"
                        href="http://www.ami.cz"><a class="moz-txt-link-abbreviated" href="http://www.ami.cz">www.ami.cz</a></a></p>
                  </td>
                  <td style="BORDER-RIGHT: rgb(204,204,204) 1px solid">   </td>
                  <td>   </td>
                  <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                    sans-serif; COLOR: rgb(0,0,0)">
                    <p><img moz-do-not-send="true" title="AMI Praha
                        a.s." alt=""
                        src="http://www.ami.cz/images/podpis/ami_logo.gif"
                        border="0"></p>
                  </td>
                </tr>
                <tr>
                  <td colspan="8"><br>
                    <a moz-do-not-send="true"
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management"><img
                        moz-do-not-send="true" alt=""
                        src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png"
                        border="0"></a></td>
                </tr>
                <tr>
                  <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                    sans-serif; COLOR: rgb(128,128,128)" colspan="8"><br>
                    Textem tohoto e-mailu podepisující neslibuje uzavřít
                    ani neuzavírá za společnost AMI Praha a.s.<br>
                    jakoukoliv smlouvu. Každá smlouva, pokud bude
                    uzavřena, musí mít výhradně písemnou formu.</td>
                </tr>
              </tbody>
            </table>
          </div>
        </div>
        <div> </div>
        <div> </div>
        <div> </div>
        <div>------ Původní zpráva ------</div>
        <div>Od: "Pavol Mederly" <<a moz-do-not-send="true"
            href="mailto:mederly@evolveum.com">mederly@evolveum.com</a>></div>
        <div>Komu: <a moz-do-not-send="true"
            href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a></div>
        <div>Odesláno: 12.4.2016 6:35:59</div>
        <div>Předmět: Re: [midPoint] catch delta events in template</div>
        <div> </div>
        <div id="x68e8301635364e4c93d0741d1b01b973" style="COLOR:
          #000000">
          <blockquote class="cite2" cite="570C7B2F.3040008@evolveum.com"
            type="cite">Hello Roman,<br>
            <br>
            I'm not sure I understand what you're trying to achieve.<br>
            <br>
            Do you want to do something like this?<br>
            <br>
            " IF attribute X was changed <br>
                THEN do something with attribute Y ?"<br>
            <br>
            Could you provide a more specific description, please?<br>
            <br>
            Best regards,<br>
            Pavol<br>
            <br>
            <br>
            <div class="moz-cite-prefix">On 11.04.2016 16:21, Roman
              Pudil - AMI Praha a.s. wrote:<br>
            </div>
            <blockquote class="cite"
              cite="mid:em2fee4dcb-2fc1-43ce-886c-4348354f7db8@rpudil-dell7440"
              type="cite">
              <style><![CDATA[#x2cc747d0139c451cbb53860f8b96fdaf BLOCKQUOTE.cite
{PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px}
#x2cc747d0139c451cbb53860f8b96fdaf BLOCKQUOTE.cite2
{MARGIN-TOP: 3px; PADDING-TOP: 0px; PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px}
#x2cc747d0139c451cbb53860f8b96fdaf .plain PRE, #x2cc747d0139c451cbb53860f8b96fdaf .plain TT
{FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal}
#x2cc747d0139c451cbb53860f8b96fdaf A IMG
{BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px}
#x2cc747d0139c451cbb53860f8b96fdaf .plain PRE, #x2cc747d0139c451cbb53860f8b96fdaf .plain TT, #x2cc747d0139c451cbb53860f8b96fdaf
{FONT-SIZE: 12pt; FONT-FAMILY: Tahoma}
#x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 BLOCKQUOTE.cite2
{MARGIN-TOP: 3px; PADDING-TOP: 0px; PADDING-LEFT: 10px; MARGIN-LEFT: 5px; BORDER-LEFT: #cccccc 1px solid; PADDING-RIGHT: 0px; MARGIN-RIGHT: 0px}
#x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain PRE, #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain TT
{FONT-SIZE: 100%; FONT-FAMILY: monospace; FONT-WEIGHT: normal; FONT-STYLE: normal}
#x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 A IMG
{BORDER-TOP: 0px; BORDER-RIGHT: 0px; BORDER-BOTTOM: 0px; BORDER-LEFT: 0px}
#x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0, #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain PRE, #x2cc747d0139c451cbb53860f8b96fdaf #x8c9c3951f6534f5383f55258201cf7e0 .plain TT
{FONT-SIZE: 12pt; FONT-FAMILY: Tahoma}
]]></style>
              <div><span id="xb91cc98f19b044e98423450ae345ebd7">
                  <div>Hi Ivan,</div>
                  <div>once more: </div>
                  <div>How to get (or check) in user template, that
                    current attribute is changing? How to do it? Some
                    code about deltas?</div>
                  <div> </div>
                  <div>Your script about "isNew" variable (see later)
                    evaluates attribute every time when user object is
                    changed (without changing this attribute).</div>
                  <div> </div>
                  <div>Thanks!</div>
                  <div>Regards</div>
                </span></div>
              <div> </div>
              <div id="signature_old">
                <div style="FONT-SIZE: 12pt; FONT-FAMILY: Tahoma">
                  <table style="WHITE-SPACE: normal; WORD-SPACING: 0px;
                    BORDER-COLLAPSE: collapse; TEXT-TRANSFORM: none;
                    COLOR: rgb(0,0,0); FONT: medium 'Times New Roman';
                    WIDOWS: 1; LETTER-SPACING: normal; TEXT-INDENT: 0px;
                    -webkit-text-stroke-width: 0px">
                    <tbody>
                      <tr>
                        <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                          sans-serif; VERTICAL-ALIGN: bottom; COLOR:
                          rgb(0,0,0)" colspan="2">
                          <p><span style="FONT-SIZE: 14px; FONT-WEIGHT:
                              bold">Roman Pudil</span><br>
                            solution architect<br>
                            <br>
                            gsm: [+420] 775 663 666<br>
                            e-mail:<span class="Apple-converted-space"> </span><a
                              moz-do-not-send="true"
                              class="moz-txt-link-abbreviated"
                              href="mailto:roman.pudil@ami.cz"><a class="moz-txt-link-abbreviated" href="mailto:roman.pudil@ami.cz">roman.pudil@ami.cz</a></a></p>
                        </td>
                        <td style="BORDER-RIGHT: rgb(204,204,204) 1px
                          solid">   </td>
                        <td>   </td>
                        <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                          sans-serif; VERTICAL-ALIGN: bottom; COLOR:
                          rgb(0,0,0)">
                          <p>AMI Praha a.s.<br>
                            Pláničkova 11<br>
                            162 00 Praha 6<br>
                            tel./fax: [+420] 274 783 239<br>
                            web:<span class="Apple-converted-space"> </span><a
                              moz-do-not-send="true"
                              class="moz-txt-link-abbreviated"
                              href="http://www.ami.cz"><a class="moz-txt-link-abbreviated" href="http://www.ami.cz">www.ami.cz</a></a></p>
                        </td>
                        <td style="BORDER-RIGHT: rgb(204,204,204) 1px
                          solid">   </td>
                        <td>   </td>
                        <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                          sans-serif; COLOR: rgb(0,0,0)">
                          <p><img title="AMI Praha a.s." alt=""
                              src="http://www.ami.cz/images/podpis/ami_logo.gif"
                              moz-do-not-send="true" border="0"></p>
                        </td>
                      </tr>
                      <tr>
                        <td colspan="8"><br>
                          <a
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management"
                            moz-do-not-send="true"><img alt=""
                              src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png"
                              moz-do-not-send="true" border="0"></a></td>
                      </tr>
                      <tr>
                        <td style="FONT-SIZE: 11px; FONT-FAMILY: Arial,
                          sans-serif; COLOR: rgb(128,128,128)"
                          colspan="8"><br>
                          Textem tohoto e-mailu podepisující neslibuje
                          uzavřít ani neuzavírá za společnost AMI Praha
                          a.s.<br>
                          jakoukoliv smlouvu. Každá smlouva, pokud bude
                          uzavřena, musí mít výhradně písemnou formu.</td>
                      </tr>
                    </tbody>
                  </table>
                </div>
              </div>
              <div> </div>
              <div> </div>
              <div> </div>
              <div>------ Původní zpráva ------</div>
              <div>Od: "Roman Pudil - AMI Praha a.s." <<a
                  moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:roman.pudil@ami.cz"><a class="moz-txt-link-abbreviated" href="mailto:roman.pudil@ami.cz">roman.pudil@ami.cz</a></a>></div>
              <div>Komu: "midPoint General Discussion" <<a
                  moz-do-not-send="true"
                  class="moz-txt-link-abbreviated"
                  href="mailto:midpoint@lists.evolveum.com"><a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a></a>></div>
              <div>Odesláno: 7.4.2016 13:15:00</div>
              <div>Předmět: Re[2]: [midPoint] catch delta events in
                template</div>
              <div> </div>
              <div id="x2cc747d0139c451cbb53860f8b96fdaf" class="class">
                <blockquote class="cite2"
                  cite="em862fed24-2083-418e-88e8-e9b601d77936@rpudil-dell7440"
                  type="cite">
                  <div>Thanks! This works!</div>
                  <div> </div>
                  <div> </div>
                  <div id="signature_old">
                    <div style="FONT-SIZE: 12pt; FONT-FAMILY: Tahoma">
                      <table style="WHITE-SPACE: normal; WORD-SPACING:
                        0px; BORDER-COLLAPSE: collapse; TEXT-TRANSFORM:
                        none; COLOR: rgb(0,0,0); FONT: medium 'Times New
                        Roman'; WIDOWS: 1; LETTER-SPACING: normal;
                        TEXT-INDENT: 0px; -webkit-text-stroke-width:
                        0px">
                        <tbody>
                          <tr>
                            <td style="FONT-SIZE: 11px; FONT-FAMILY:
                              Arial, sans-serif; VERTICAL-ALIGN: bottom;
                              COLOR: rgb(0,0,0)" colspan="2">
                              <p><span style="FONT-SIZE: 14px;
                                  FONT-WEIGHT: bold">Roman Pudil</span><br>
                                solution architect<br>
                                <br>
                                gsm: [+420] 775 663 666<br>
                                e-mail:<span
                                  class="Apple-converted-space"> </span><a
                                  moz-do-not-send="true"
                                  class="moz-txt-link-abbreviated"
                                  href="mailto:roman.pudil@ami.cz"><a class="moz-txt-link-abbreviated" href="mailto:roman.pudil@ami.cz">roman.pudil@ami.cz</a></a></p>
                            </td>
                            <td style="BORDER-RIGHT: rgb(204,204,204)
                              1px solid">   </td>
                            <td>   </td>
                            <td style="FONT-SIZE: 11px; FONT-FAMILY:
                              Arial, sans-serif; VERTICAL-ALIGN: bottom;
                              COLOR: rgb(0,0,0)">
                              <p>AMI Praha a.s.<br>
                                Pláničkova 11<br>
                                162 00 Praha 6<br>
                                tel./fax: [+420] 274 783 239<br>
                                web:<span class="Apple-converted-space"> </span><a
                                  moz-do-not-send="true"
                                  class="moz-txt-link-freetext"
                                  href="http://www.ami.cz/"><a class="moz-txt-link-freetext" href="http://www.ami.cz/">http://www.ami.cz/</a></a></p>
                            </td>
                            <td style="BORDER-RIGHT: rgb(204,204,204)
                              1px solid">   </td>
                            <td>   </td>
                            <td style="FONT-SIZE: 11px; FONT-FAMILY:
                              Arial, sans-serif; COLOR: rgb(0,0,0)">
                              <p><img title="AMI Praha a.s." alt=""
                                  src="http://www.ami.cz/images/podpis/ami_logo.gif"
                                  moz-do-not-send="true" border="0"></p>
                            </td>
                          </tr>
                          <tr>
                            <td colspan="8"><br>
                              <a
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management"
                                moz-do-not-send="true"><img alt=""
                                  src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png"
                                  moz-do-not-send="true" border="0"></a></td>
                          </tr>
                          <tr>
                            <td style="FONT-SIZE: 11px; FONT-FAMILY:
                              Arial, sans-serif; COLOR:
                              rgb(128,128,128)" colspan="8"><br>
                              Textem tohoto e-mailu podepisující
                              neslibuje uzavřít ani neuzavírá za
                              společnost AMI Praha a.s.<br>
                              jakoukoliv smlouvu. Každá smlouva, pokud
                              bude uzavřena, musí mít výhradně písemnou
                              formu.</td>
                          </tr>
                        </tbody>
                      </table>
                    </div>
                  </div>
                  <div> </div>
                  <div> </div>
                  <div> </div>
                  <div>------ Původní zpráva ------</div>
                  <div>Od: "Ivan Noris" <<a moz-do-not-send="true"
                      class="moz-txt-link-abbreviated"
                      href="mailto:ivan.noris@evolveum.com">ivan.noris@evolveum.com</a>></div>
                  <div>Komu: <a
                      href="mailto:midpoint@lists.evolveum.com"
                      moz-do-not-send="true"><a class="moz-txt-link-abbreviated" href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a></a></div>
                  <div>Odesláno: 7.4.2016 11:51:30</div>
                  <div>Předmět: Re: [midPoint] catch delta events in
                    template</div>
                  <div> </div>
                  <div id="x8c9c3951f6534f5383f55258201cf7e0"
                    style="COLOR: #000000">
                    <blockquote class="cite2"
                      cite="57062DA2.80400@evolveum.com" type="cite">Hi
                      Roman,<br>
                      <br>
                      I was using this in user template to copy each
                      change of emailAddress attribute, i.e. only new
                      addresses entered there, to extended attribute
                      allMailAddresses (to keep all previous addresses):<br>
                      <br>
                          <mapping><br>
                              <name>copy emailAddress on
                      change</name><br>
                              <source><br>
                                 
                      <path>$user/employeeType</path><br>
                              </source><br>
                              <source><br>
                                 
                      <path>$user/emailAddress</path><br>
                              </source><br>
                              <expression><br>
                              <script><br>
                                  <code><br>
                      boolean isNew =
com.evolveum.midpoint.model.common.expression.script.ScriptExpressionEvaluationContext.getThreadLocal().isEvaluateNew()<br>
                      if (isNew &amp;&amp;
                      !basic.isEmpty(emailAddress)) return emailAddress<br>
                                  </code><br>
                              </script><br>
                          </expression><br>
                              <target><br>
                                 
                      <path>$user/extension/allMailAddresses</path><br>
                              </target><br>
                              <condition><br>
                                   <script><br>
                                      <code>employeeType == 'EMP'
                      || employeeType == 'EXT'</code><br>
                                  </script>  <br>
                              </condition><br>
                             
                      <evaluationPhase>afterAssignments</evaluationPhase><br>
                          </mapping><br>
                      <br>
                      Regards,<br>
                      Ivan<br>
                      <br>
                      <br>
                      <div class="moz-cite-prefix">On 04/07/2016 11:45
                        AM, Roman Pudil - AMI Praha a.s. wrote:<br>
                      </div>
                      <blockquote class="cite"
                        cite="mid:emcbb807f8-a21f-42f3-a8a9-e142b442a30a@rpudil-dell7440"
                        type="cite">
                        <div>Hi all,</div>
                        <div> </div>
                        <div>how to catch delta events in user template
                          (similar "events" objects in notifications)?</div>
                        <div> </div>
                        <div>Situation - example:</div>
                        <ol>
                          <li>
                            <div>User has familyName = "oldFamilyName"</div>
                          </li>
                          <li>
                            <div>Helpdesk Operator change familyname (in
                              GUI) from "oldFamilyName" to
                              "newFamilyName"</div>
                          </li>
                          <li>
                            <div>I need catch (probably in User
                              Template?) ONLY new value "newFamilyName"
                              and operate with this.</div>
                          </li>
                        </ol>
                        <div>Thanks!</div>
                        <div> </div>
                        <div>Regards</div>
                        <div> </div>
                        <div>Roman Pudil</div>
                        <div> </div>
                        <div id="signature_old">
                          <div style="FONT-SIZE: 12pt; FONT-FAMILY:
                            Tahoma">
                            <table style="WHITE-SPACE: normal;
                              WORD-SPACING: 0px; BORDER-COLLAPSE:
                              collapse; TEXT-TRANSFORM: none; COLOR:
                              rgb(0,0,0); FONT: medium 'Times New
                              Roman'; WIDOWS: 1; LETTER-SPACING: normal;
                              TEXT-INDENT: 0px;
                              -webkit-text-stroke-width: 0px">
                              <tbody>
                                <tr>
                                  <td style="FONT-SIZE: 11px;
                                    FONT-FAMILY: Arial, sans-serif;
                                    VERTICAL-ALIGN: bottom; COLOR:
                                    rgb(0,0,0)" colspan="2">
                                    <p><span style="FONT-SIZE: 14px;
                                        FONT-WEIGHT: bold">Roman Pudil</span><br>
                                      solution architect<br>
                                      <br>
                                      gsm: [+420] 775 663 666<br>
                                      e-mail:<span
                                        class="Apple-converted-space"> </span><a
                                        moz-do-not-send="true"
                                        class="moz-txt-link-abbreviated"
                                        href="mailto:roman.pudil@ami.cz"><a class="moz-txt-link-abbreviated" href="mailto:roman.pudil@ami.cz">roman.pudil@ami.cz</a></a></p>
                                  </td>
                                  <td style="BORDER-RIGHT:
                                    rgb(204,204,204) 1px solid">   </td>
                                  <td>   </td>
                                  <td style="FONT-SIZE: 11px;
                                    FONT-FAMILY: Arial, sans-serif;
                                    VERTICAL-ALIGN: bottom; COLOR:
                                    rgb(0,0,0)">
                                    <p>AMI Praha a.s.<br>
                                      Pláničkova 11<br>
                                      162 00 Praha 6<br>
                                      tel./fax: [+420] 274 783 239<br>
                                      web:<span
                                        class="Apple-converted-space"> </span><a
                                        moz-do-not-send="true"
                                        class="moz-txt-link-freetext"
                                        href="http://www.ami.cz/"><a class="moz-txt-link-freetext" href="http://www.ami.cz/">http://www.ami.cz/</a></a></p>
                                  </td>
                                  <td style="BORDER-RIGHT:
                                    rgb(204,204,204) 1px solid">   </td>
                                  <td>   </td>
                                  <td style="FONT-SIZE: 11px;
                                    FONT-FAMILY: Arial, sans-serif;
                                    COLOR: rgb(0,0,0)">
                                    <p><img title="AMI Praha a.s."
                                        alt=""
                                        src="http://www.ami.cz/images/podpis/ami_logo.gif"
                                        moz-do-not-send="true"
                                        border="0"></p>
                                  </td>
                                </tr>
                                <tr>
                                  <td colspan="8"><br>
                                    <a
href="http://www.ami.cz/reseni-a-sluzby/bezpecnost-dat/identity-management"
                                      moz-do-not-send="true"><img alt=""
src="http://www.ami.cz/images/podpis/AMI-podpis-IdM_1.png"
                                        moz-do-not-send="true"
                                        border="0"></a></td>
                                </tr>
                                <tr>
                                  <td style="FONT-SIZE: 11px;
                                    FONT-FAMILY: Arial, sans-serif;
                                    COLOR: rgb(128,128,128)" colspan="8"><br>
                                    Textem tohoto e-mailu podepisující
                                    neslibuje uzavřít ani neuzavírá za
                                    společnost AMI Praha a.s.<br>
                                    jakoukoliv smlouvu. Každá smlouva,
                                    pokud bude uzavřena, musí mít
                                    výhradně písemnou formu.</td>
                                </tr>
                              </tbody>
                            </table>
                          </div>
                        </div>
                        <div> </div>
                        <br>
                        <fieldset class="mimeAttachmentHeader"></fieldset>
                        <br>
                        <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com" moz-do-not-send="true">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint" moz-do-not-send="true">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
                      </blockquote>
                      <br>
                      <pre class="moz-signature" cols="72">-- 
  Ing. Ivan Noris
  Senior Identity Management Engineer & IDM Architect
  evolveum.com                     evolveum.com/blog/
  ___________________________________________________
  "Semper ID(e)M Vix."
</pre>
                    </blockquote>
                  </div>
                </blockquote>
              </div>
              <br>
              <fieldset class="mimeAttachmentHeader"></fieldset>
              <br>
              <pre wrap="">_______________________________________________
midPoint mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
            </blockquote>
            <br>
          </blockquote>
        </div>
        <br>
        <fieldset class="mimeAttachmentHeader"></fieldset>
        <br>
        <pre wrap="">_______________________________________________
midPoint mailing list
<a moz-do-not-send="true" class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a moz-do-not-send="true" class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
      </blockquote>
      <br>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <br>
      <pre wrap="">_______________________________________________
midPoint mailing list
<a class="moz-txt-link-abbreviated" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a class="moz-txt-link-freetext" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre>
    </blockquote>
    <br>
    <br>
  </body>
</html>