[midPoint] HTML in E-mail Notifications
Doler, Alexander Earl (LATCO - Buenos Aires)
adoler at deloitte.com
Mon Apr 17 16:48:13 CEST 2017
Hi Pavol,
Thank you very much for this detailed response. I am currently working on this and implementing your suggestions. I will let you know how it goes and if I have any more questions.
Thanks again!
Best,
Alex
From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Pavol Mederly
Sent: jueves, 13 de abril de 2017 7:18 p. m.
To: midpoint at lists.evolveum.com
Subject: Re: [midPoint] HTML in E-mail Notifications
PS: actually, your code should produce a NullPointerException in the log, as assignee should be null. Isn't it so?
If I'm not mistaken, the correct recipientExpression for your situation should do something like:
1. take event.workItem.candidateRolesRef array (it should have one element: the reference to Org to which the item is assigned)
2. find all the members using e.g. the approach I mentioned in previous mail
3. return all email addresses of these users
Pavol Mederly
Software developer
evolveum.com
On 14.04.2017 0:02, Pavol Mederly wrote:
Hello Alex,
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.
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.
I see these options for you:
1. 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.
2. 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.
3. 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.)
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.
--
Example of approver-finding expression (not tested ... but you will certainly be able to make it work):
import com.evolveum.midpoint.prism.query.builder.QueryBuilder
import com.evolveum.midpoint.xml.ns._public.common.common_3.*
def q = QueryBuilder.queryFor(UserType.class, midpoint.prismContext)
.isDirectChildOf(".......oid...of...your...org............")
.build()
def users = midpoint.searchObjects(UserType.class, q, null)
return users.collect { it.oid }
Pavol Mederly
Software developer
evolveum.com
On 13.04.2017 19:24, Doler, Alexander Earl (LATCO - Buenos Aires) wrote:
Hi Pavol and Jason,
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.
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:
<handler>
<simpleWorkflowNotifier>
<category>workItemEvent</category>
<operation>add</operation>
<recipientExpression>
<script>
<code>
assignee.getEmailAddress();
</code>
</script>
</recipientExpression>
<transport>mail</transport>
</simpleWorkflowNotifier>
</handler>
Again, only the first approver receives an e-mail notification, but after it is approved, the subsequent approvers are not notified by mail.
Thanks again!
Alex
From: midPoint [mailto:midpoint-bounces at lists.evolveum.com] On Behalf Of Pavol Mederly
Sent: miércoles, 12 de abril de 2017 1:33 p. m.
To: midpoint at lists.evolveum.com<mailto:midpoint at lists.evolveum.com>
Subject: Re: [midPoint] HTML in E-mail Notifications
Jason,
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. :)
See:
https://github.com/Evolveum/midpoint/commit/f367a02a8b2c30b2a5b06036c082af252c533129
https://github.com/Evolveum/midpoint/commit/441f4dc796338b53f704fc5b8d0ea8fd8a2f634c
Alex:
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 here<https://github.com/Evolveum/midpoint/commit/2ebd620b70bff76fcbc5c276ea610ec2d9c55516>). 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.
Best regards,
Pavol Mederly
Software developer
evolveum.com
On 12.04.2017 18:19, Jason Everling wrote:
It was added in 3.6 according to the JIRA entry, https://jira.evolveum.com/browse/MID-2072 <https://jira.evolveum.com/browse/MID-2072> , another reason why I need to get ours updated.
JASON
On Wed, Apr 12, 2017 at 10:37 AM, Doler, Alexander Earl (LATCO - Buenos Aires) <adoler at deloitte.com<mailto:adoler at deloitte.com>> wrote:
Hello,
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?
I have tried adding the tags in the notification configuration as follows, in order to permit the bodyExpression to read HTML.
<contentTypeExpression>
<value>text/html; charset=utf-8</value>
</contentTypeExpression>
However, the contentTypeExpression tag is not recognized when I save the SystemConfiguration XML file. I am currently using version 3.5.1.
Best regards,
Alex
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
http://lists.evolveum.com/mailman/listinfo/midpoint
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
http://lists.evolveum.com/mailman/listinfo/midpoint
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
http://lists.evolveum.com/mailman/listinfo/midpoint
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com<mailto:midPoint at lists.evolveum.com>
http://lists.evolveum.com/mailman/listinfo/midpoint
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20170417/c9cc1958/attachment.htm>
More information about the midPoint
mailing list