<html><body><div style="font-family: times new roman, new york, times, serif; font-size: 12pt; color: #000000"><div>Hi Jason,<br></div><div><br></div><div>first please see the wiki page referenced by Roman in previous e-mail (https://wiki.evolveum.com/display/midPoint/Script+Expression+Functions). This is handy also for other usages.<br></div><div><br></div><div>Back to notifications. I've just hacked my notifications like this to show you how to access user's properties:<br></div><div><br></div><div> <handler><br> <simpleUserNotifier><br> <recipientExpression><br> <value>vix@localhost</value><br> </recipientExpression><br> <subjectExpression><br> <script><br> <code><br>if (event.isSuccess())<br> tmpText = "[IDM] SUCCESS: User " + event.getChangeType() + " operation succeeded for "<br>else if (event.isFailure())<br> tmpText = "[IDM] ERROR: User " + event.getChangeType() + " operation failed for "<br>else tmpText = "[IDM] IN PROGRESS: User " + event.getChangeType() + " operation in progress for "<br><br>tmpText + requestee?.getName()?.getOrig() + ', family= ' + requestee?.getFamilyName()?.getOrig() + ', employee number= ' + requestee?.getEmployeeNumber() + ', property employeeNumber= ' + basic.getPropertyValue(requestee, 'employeeNumber')<br></code><br> </script><br> </subjectExpression><br> <transport>mail</transport><br> </simpleUserNotifier><br> </handler></div><div><br></div><div>Subject in e-mail became:<br></div><div><br></div><div>Subject: [IDM] SUCCESS: User ADD operation succeeded for bbbbb,<br> family= Rimmer, employee number= 12123434,<br> property employeeNumber= 12123434<br><br></div><div>For standard polystring attributes, you may use simple requestee?.getFamilyName()?.getOrig()<br></div><div>For standard string attributes, you may use simple requestee?.getEmployeeNumber()<br></div><div><br></div><div>Please see our Common Schema to see which attribute is Polystring.<br></div><div><br></div><div>Or you can use Basic library's basic.getPropertyValue(requestee, 'employeeNumber').<br></div><div><br></div><div>To access the extended attributes, you need to use Basic library (basic.getExtensionPropertyValue(...))<br></div><div><br></div><div>I have already added such examples to our <a href="https://wiki.evolveum.com/display/midPoint/Notifications">https://wiki.evolveum.com/display/midPoint/Notifications</a> page earlier.<br></div><div><br></div><div>Regards,<br></div><div>Ivan<br></div><div><br></div><div><br></div><hr id="zwchr"><blockquote style="border-left:2px solid #1010FF;margin-left:5px;padding-left:5px;color:#000;font-weight:normal;font-style:normal;text-decoration:none;font-family:Helvetica,Arial,sans-serif;font-size:12pt;" data-mce-style="border-left: 2px solid #1010FF; margin-left: 5px; padding-left: 5px; color: #000; font-weight: normal; font-style: normal; text-decoration: none; font-family: Helvetica,Arial,sans-serif; font-size: 12pt;"><b>From: </b>"Jason Everling" <jeverling@bshp.edu><br><b>To: </b>"midPoint General Discussion" <midpoint@lists.evolveum.com><br><b>Sent: </b>Thursday, October 30, 2014 7:39:01 PM<br><b>Subject: </b>Re: [midPoint] Email Notification<br><div><br></div><div dir="ltr">I got this down, I had to figure out where and what these were for \n\n but I was able to add a ton of information that was needed.<div><br></div><div>I need to add in the password and Employee Number which is actually the student ID,</div><div><br></div><div>Is this correct, I couldn't find much on the subject,</div><div><br></div><div>Your Password is " + requestee?.getPassword()?.getOrig()<br></div><div>Your Student ID is " + requestee?.getEmployeeNumber()?.getOrig()<br></div><div><br></div><div>Thanks for all your help!</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 3:07 PM, Jason Everling <span dir="ltr"><<a href="mailto:jeverling@bshp.edu" target="_blank" data-mce-href="mailto:jeverling@bshp.edu">jeverling@bshp.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div dir="ltr">Ohh I see, Thanks!<div><br></div><div>JASON</div></div><div class="HOEnZb"><div class="h5"><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Oct 29, 2014 at 3:01 PM, Ivan Noris <span dir="ltr"><<a href="mailto:ivan.noris@evolveum.com" target="_blank" data-mce-href="mailto:ivan.noris@evolveum.com">ivan.noris@evolveum.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div>Hi Jason,<span><span><br> <br></span></span><div>On 10/29/2014 07:26 PM, Jason Everling wrote:<br></div><blockquote><div dir="ltr">Not that one, that one works just fine but if I try to add to it is when it fails, like<div><br></div><div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"><bodyExpression></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> <script></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> <code></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> Welome to blah blah, the following below are links to the various resources you will use here</div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> </div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> Your Username is + requestee?.getName()?.getOrig()</div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"><br></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> You should login and should your password at <a href="http://www.example/com" target="_blank" data-mce-href="http://www.example/com">http://www.example/com</a><br></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"><br></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> Link 1</div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> Link 2<br></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> Link 3<br></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> </code></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"> </script></div><div style="font-family:arial,sans-serif;font-size:13px" data-mce-style="font-family: arial,sans-serif; font-size: 13px;"></bodyExpression></div></div></div><div class="gmail_extra"><br></div></blockquote> I see. But the answer is very simple: everything in <code> is a groovy expression. Return value of this expression is what will be used for e-mail body (in this case).<br> <br> For example in my previous sample, the Groovy expression "[IDM] Your username is: " + requestee?.getName()?.getOrig() is actually the same as:<br> <br> return <b>"</b>[IDM] Your username is: <b>"</b> <b>+</b> requestee?.getName()?.getOrig()<br> <br> In your case, you are missing:<br> 1) quotes for strings<br> 2) + operator for concatenating strings<br> <br> So your example needs to be rewritten to maintain your required formatting, as:<br> <br> <bodyExpression><br> <script><br> <code><br> "Welome to blah blah, the following below are links to the various resources you will use here. \n" + "Your Username is " + requestee?.getName()?.getOrig() + "\nYou should login and should your password at <a href="http://www.example/com" target="_blank" data-mce-href="http://www.example/com">http://www.example/com</a>"<br> </code><br> </script><br> </bodyExpression><br> <br> (this is a copy/paste from actual System Configuration)<br> <br> Which will produce notification for example:<span><br> <br> Welome to blah blah, the following below are links to the various resources<br></span> you will use here. <br> Your Username is hulahop<span><br> You should login and should your password at <a href="http://www.example/com" target="_blank" data-mce-href="http://www.example/com">http://www.example/com</a><br> <br></span> (this is copy/paste from actual e-mail that was sent).<br> <br> So now you should be able to do anything (except the HTML discussed earlier).<br> <br> Regards,<br> Ivan<br> <br><blockquote><div class="gmail_extra"><div class="gmail_quote">On Wed, Oct 29, 2014 at 1:18 PM, Ivan Noris <span dir="ltr"><<a href="mailto:ivan.noris@evolveum.com" target="_blank" data-mce-href="mailto:ivan.noris@evolveum.com">ivan.noris@evolveum.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex" data-mce-style="margin: 0 0 0 .8ex; border-left: 1px #ccc solid; padding-left: 1ex;"><div>Hi Jason,<br> <br> so the following didn't work for you? It looks ok at the first look.<br> <br> Do you get any exception when sending notifications? Errors in log? What precisely "does not work"? I'll try to replicate the behaviour. But please send the whole notification handler which does not work. Thank you.<span><span><br></span></span><div><br></div><blockquote><div><bodyExpression><br></div><div><div><span style="white-space:pre-wrap" data-mce-style="white-space: pre-wrap;"> </span><script></div><div><span style="white-space:pre-wrap" data-mce-style="white-space: pre-wrap;"> </span><code></div><div><span style="white-space:pre-wrap" data-mce-style="white-space: pre-wrap;"> </span>"[IDM] Your username is: " + requestee?.getName()?.getOrig()</div><div><span style="white-space:pre-wrap" data-mce-style="white-space: pre-wrap;"> </span></code></div><div><span style="white-space:pre-wrap" data-mce-style="white-space: pre-wrap;"> </span></script></div><div></bodyExpression></div></div></blockquote><span><br> </span> Regards,<br> Ivan<span><span><br></span></span><pre>--
Ing. Ivan Noris
Senior Identity Management Engineer
<a href="http://evolveum.com" target="_blank" data-mce-href="http://evolveum.com">evolveum.com</a>
___________________________________________
"Idem per idem - semper idem Vix."
</pre></div><br> _______________________________________________<br> midPoint mailing list<br> <a href="mailto:midPoint@lists.evolveum.com" target="_blank" data-mce-href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br> <a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank" data-mce-href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br> <br></blockquote></div><br></div><span><br> </span><span><br> <br><span> CONFIDENTIALITY NOTICE:<br> This e-mail together with any attachments is proprietary and confidential; intended for only the recipient(s) named above and may contain information that is privileged. You should not retain, copy or use this e-mail or any attachments for any purpose, or disclose all or any part of the contents to any person. Any views or opinions expressed in this e-mail are those of the author and do not represent those of the Baptist School of Health Professions. If you have received this e-mail in error, or are not the named recipient(s), you are hereby notified that any review, dissemination, distribution or copying of this communication is prohibited by the sender and to do so might constitute a violation of the Electronic Communications Privacy Act, 18 U.S.C. section 2510-2521. Please immediately notify the sender and delete this e-mail and any attachments from your computer. </span></span><br> <br><fieldset></fieldset><br><pre>_______________________________________________
midPoint mailing list
<a href="mailto:midPoint@lists.evolveum.com" target="_blank" data-mce-href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a>
<a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank" data-mce-href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a>
</pre></blockquote><span><span> <br></span></span><pre>--
Ing. Ivan Noris
Senior Identity Management Engineer
<a href="http://evolveum.com" target="_blank" data-mce-href="http://evolveum.com">evolveum.com</a>
___________________________________________
"Idem per idem - semper idem Vix."
</pre></div><br>_______________________________________________<br> midPoint mailing list<br> <a href="mailto:midPoint@lists.evolveum.com" target="_blank" data-mce-href="mailto:midPoint@lists.evolveum.com">midPoint@lists.evolveum.com</a><br> <a href="http://lists.evolveum.com/mailman/listinfo/midpoint" target="_blank" data-mce-href="http://lists.evolveum.com/mailman/listinfo/midpoint">http://lists.evolveum.com/mailman/listinfo/midpoint</a><br> <br></blockquote></div><br></div></div></div></blockquote></div><br></div><br> <span style="font-size: small;" data-mce-style="font-size: small;" size="2"><span style="font-size: small;" data-mce-style="font-size: small;" size="2"><br></span></span><div><br></div><span style="font-size: small;" data-mce-style="font-size: small;" size="2">CONFIDENTIALITY NOTICE:<br>This e-mail together with any attachments is proprietary and confidential; intended for only the recipient(s) named above and may contain information that is privileged. You should not retain, copy or use this e-mail or any attachments for any purpose, or disclose all or any part of the contents to any person. Any views or opinions expressed in this e-mail are those of the author and do not represent those of the Baptist School of Health Professions. If you have received this e-mail in error, or are not the named recipient(s), you are hereby notified that any review, dissemination, distribution or copying of this communication is prohibited by the sender and to do so might constitute a violation of the Electronic Communications Privacy Act, 18 U.S.C. section 2510-2521. Please immediately notify the sender and delete this e-mail and any attachments from your computer. </span><br><div><br></div>_______________________________________________<br>midPoint mailing list<br>midPoint@lists.evolveum.com<br>http://lists.evolveum.com/mailman/listinfo/midpoint<br></blockquote><div><br><br></div><div><br></div><div>-- <br></div><div><span name="x"></span> Ing. Ivan Noris<br> Senior Identity Management Engineer<br> evolveum.com<br> ___________________________________________<br> "Idem per idem - semper idem Vix."<span name="x"></span><br></div></div></body></html>