<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <p>PS: actually, your code should produce a NullPointerException in
      the log, as assignee should be null. Isn't it so?</p>
    <p>If I'm not mistaken, the correct recipientExpression for your
      situation should do something like:</p>
    <ol>
      <li>take event.workItem.candidateRolesRef array (it should have
        one element: the reference to Org to which the item is assigned)</li>
      <li>find all the members using e.g. the approach I mentioned in
        previous mail</li>
      <li>return all email addresses of these users<br>
      </li>
    </ol>
    <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
</pre>
    <div class="moz-cite-prefix">On 14.04.2017 0:02, Pavol Mederly
      wrote:<br>
    </div>
    <blockquote
      cite="mid:879bd72e-39f8-5e11-60b0-aa625f20a5d2@evolveum.com"
      type="cite">
      <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
      Hello Alex,<br>
      <br>
      this is a bit tricky. The support for candidate approvers (the
      ones that get their work items under "items claimable by me") is a
      bit half-hearted, so to say. It basically works, but there are
      some missing pieces, like notifications (as you found out), maybe
      auditing, maybe delegation/escalation (in 3.6), and so on. Some of
      these might work but I'm not sure they all were properly
      implemented and tested.<br>
      <br>
      If I would have a bit of time, I would try to fix that for 3.6.
      Unfortunately, there's really too little chance to get enough
      time; so it will probably stay as it is: unfinished in these
      aspects.<br>
      <br>
      I see these options for you:<br>
      <ol>
        <li>In 3.6, there will be a possibility to set "groupExpansion =
          onWorkItemCreation" that will expand orgs and roles
          statically, at the time of work item creation (i.e. when
          entering an approval level/stage). So, in your case, each
          member of those organizations will get his own work item,
          along with proper notifications, escalation/delegation
          options, auditing, and so on.</li>
        <li>But even in 3.5, it is possible to emulate this
          "groupExpansion" option by using approverExpression: just
          provide a script that will return OIDs of all members of the
          specified org. An example is at the end of this message.<br>
        </li>
        <li>Alternatively, you can go with existing approach (candidate
          approvers). The reason why you do not get any notifications is
          that the default recipient for "work item created"
          notification (in 3.5) is the work item assignee. In your case,
          there is no assignee. But you could use
          <recipientExpression> element to provide a scripting
          expression that would return the email address(es) to which
          the notification should be sent. (At least I think this should
          work.)</li>
      </ol>
      Hope this would help. Or maybe someone on the list can see another
      idea. If not, we could perhaps return to this issue after Easter
      holidays.<br>
      <br>
      --<br>
      Example of approver-finding expression (not tested ... but you
      will certainly be able to make it work):<br>
      <br>
      import com.evolveum.midpoint.prism.query.builder.QueryBuilder<br>
      import com.evolveum.midpoint.xml.ns._public.common.common_3.*<br>
      <br>
      def q = QueryBuilder.queryFor(UserType.class,
      midpoint.prismContext)<br>
        .isDirectChildOf(".......oid...of...your...org............")<br>
        .build()<br>
      def users = midpoint.searchObjects(UserType.class, q, null)<br>
      return users.collect { it.oid }<br>
      <br>
      <pre class="moz-signature" cols="72">Pavol Mederly
Software developer
evolveum.com
 </pre>
      <div class="moz-cite-prefix">On 13.04.2017 19:24, Doler, Alexander
        Earl (LATCO - Buenos Aires) wrote:<br>
      </div>
      <blockquote
cite="mid:DM3PR85MB00749EF3E1848FE46370CBC8AA020@DM3PR85MB0074.NAMPRD85.PROD.OUTLOOK.COM"
        type="cite">
        <meta http-equiv="Content-Type" content="text/html;
          charset=utf-8">
        <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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";
        color:black;}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;
        color:black;}
p.msonormal0, li.msonormal0, div.msonormal0
        {mso-style-name:msonormal;
        mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
span.EmailStyle21
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
        <div class="WordSection1">
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Hi
              Pavol and Jason,<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">I
              was able to port the changes from Github as you indicated
              and recompile the application, and it works perfectly now!
              I am able to add HTML content to the e-mail notifications.
              Thank you for your help.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Additionally,
              I have another question regarding notifications. Some
              roles in my environment have between one and three levels
              of approval before being assigned. The first approval goes
              to the user’s manager, which is assigned directly as a
              schema-extension object. The approval notification arrives
              fine to this first approver. However, in the cases where
              there are 2-3 approvers, these subsequent approvers are
              members of sub-organizations, and only one member needs to
              approve the item for it to be approved. The approval
              request arrives to the users under “items claimable by
              me,” rather than “My items.” Crrently, no e-mail
              notification is sent to any of these approvers. I would
              like all of the members these sub-organizations to receive
              an e-mail notification to approve the item. I have the
              notification handler configured as follows:<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">     
              <handler><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">        
              <simpleWorkflowNotifier><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">           
              <category>workItemEvent</category><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">      
                   <operation>add</operation><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">           
              <recipientExpression><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">              
              <script><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">                 
              <code><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">                    
              assignee.getEmailAddress();<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">                 
              </code><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">              
              </script><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">           
              </recipientExpression><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">           
              <transport>mail</transport><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">        
              </simpleWorkflowNotifier><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">     
              </handler><o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Again,
              only the first approver receives an e-mail notification,
              but after it is approved, the subsequent approvers are not
              notified by mail.<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Thanks
              again!<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D">Alex<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:#1F497D"><o:p> </o:p></span></p>
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">
                  midPoint [<a moz-do-not-send="true"
                    class="moz-txt-link-freetext"
                    href="mailto:midpoint-bounces@lists.evolveum.com">mailto:midpoint-bounces@lists.evolveum.com</a>]
                  <b>On Behalf Of </b>Pavol Mederly<br>
                  <b>Sent:</b> miércoles, 12 de abril de 2017 1:33 p. m.<br>
                  <b>To:</b> <a moz-do-not-send="true"
                    class="moz-txt-link-abbreviated"
                    href="mailto:midpoint@lists.evolveum.com">midpoint@lists.evolveum.com</a><br>
                  <b>Subject:</b> Re: [midPoint] HTML in E-mail
                  Notifications<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <p>Jason,<o:p></o:p></p>
          <p>you are right. But - interestingly enough - Michael did the
            implementation for version 3.4.x first (because he used this
            one at that time), so actually the feature is present in
            3.4.x and in (prepared) 3.6. :)<o:p></o:p></p>
          <p>See:<br>
            <a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/commit/f367a02a8b2c30b2a5b06036c082af252c533129">https://github.com/Evolveum/midpoint/commit/f367a02a8b2c30b2a5b06036c082af252c533129</a><br>
            <a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/commit/441f4dc796338b53f704fc5b8d0ea8fd8a2f634c">https://github.com/Evolveum/midpoint/commit/441f4dc796338b53f704fc5b8d0ea8fd8a2f634c</a><o:p></o:p></p>
          <p>Alex:<br>
            <br>
            Perhaps it would not be a big issue to port it to 3.5.x
            (either this one or an independently created implementation
            that is present <a moz-do-not-send="true"
href="https://github.com/Evolveum/midpoint/commit/2ebd620b70bff76fcbc5c276ea610ec2d9c55516">here</a>).
            If you like, you can try to build 3.5.x from sources, with
            one of the above implementations applied. The latter would
            be perhaps easier to apply, because it is very limited in
            functionality and basically comprises only a few lines of
            code.<o:p></o:p></p>
          <p>Best regards,<o:p></o:p></p>
          <pre>Pavol Mederly<o:p></o:p></pre>
          <pre>Software developer<o:p></o:p></pre>
          <pre>evolveum.com<o:p></o:p></pre>
          <div>
            <p class="MsoNormal">On 12.04.2017 18:19, Jason Everling
              wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <div>
              <p class="MsoNormal">It was added in 3.6 according to the
                JIRA entry, <a moz-do-not-send="true"
                  href="https://jira.evolveum.com/browse/MID-2072"
                  target="_blank">https://jira.evolveum.com/browse/MID-2072 </a> ,
                another reason why I need to get ours updated. <o:p></o:p></p>
              <div>
                <div>
                  <div>
                    <div>
                      <p class="MsoNormal">JASON<o:p></o:p></p>
                    </div>
                  </div>
                </div>
                <p class="MsoNormal"><o:p> </o:p></p>
                <div>
                  <p class="MsoNormal">On Wed, Apr 12, 2017 at 10:37 AM,
                    Doler, Alexander Earl (LATCO - Buenos Aires) <<a
                      moz-do-not-send="true"
                      href="mailto:adoler@deloitte.com" target="_blank">adoler@deloitte.com</a>>
                    wrote:<o:p></o:p></p>
                  <blockquote style="border:none;border-left:solid
                    #CCCCCC 1.0pt;padding:0cm 0cm 0cm
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0cm;margin-bottom:5.0pt">
                    <div>
                      <div>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Hello,<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I
                          was wondering if HTML is currently supported
                          for e-mail notifications as of Midpoint 3.5 or
                          3.5.1, or if it is planned for an upcoming
                          release?<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">I
                          have tried adding the tags in the notification
                          configuration as follows, in order to permit
                          the bodyExpression to read HTML.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"><contentTypeExpression><o:p></o:p></p>
                        <p class="MsoNormal"
style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto;text-indent:36.0pt"><value>text/html;
                          charset=utf-8</value><o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"></contentTypeExpression><o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">However,
                          the contentTypeExpression tag is not
                          recognized when I save the SystemConfiguration
                          XML file. I am currently using version 3.5.1.<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Best
                          regards,<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto">Alex<o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                        <p class="MsoNormal"
                          style="mso-margin-top-alt:auto;mso-margin-bottom-alt:auto"> <o:p></o:p></p>
                      </div>
                    </div>
                    <p class="MsoNormal" style="margin-bottom:12.0pt"><br>
                      _______________________________________________<br>
                      midPoint mailing list<br>
                      <a moz-do-not-send="true"
                        href="mailto:midPoint@lists.evolveum.com"
                        target="_blank">midPoint@lists.evolveum.com</a><br>
                      <a moz-do-not-send="true"
                        href="http://lists.evolveum.com/mailman/listinfo/midpoint"
                        target="_blank">http://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></p>
                  </blockquote>
                </div>
                <p class="MsoNormal"><o:p> </o:p></p>
              </div>
            </div>
            <p class="MsoNormal"><br>
              <br>
              <br>
              <o:p></o:p></p>
            <pre>_______________________________________________<o:p></o:p></pre>
            <pre>midPoint mailing list<o:p></o:p></pre>
            <pre><a moz-do-not-send="true" href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><o:p></o:p></pre>
            <pre><a moz-do-not-send="true" href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><o:p></o:p></pre>
          </blockquote>
          <p class="MsoNormal"><o:p> </o:p></p>
        </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>
  </body>
</html>