[midPoint] Email Notification

Ivan Noris Ivan.Noris at evolveum.com
Fri Oct 31 16:00:22 CET 2014


Jason, 

you have not specified what exactly is in the logs... but I believe, that the problem is the ";" before + 

This works: tmpText + requestee?.getName()?.getOrig() + midpoint.getPlaintextUserPassword(requestee) 

So please remove the ";" in the middle of the expression and if the problem persists, please send the error message(s) from idm.log. 

Regards, 
Ivan 

----- Original Message -----

> From: "Jason Everling" <jeverling at bshp.edu>
> To: "midPoint General Discussion" <midpoint at lists.evolveum.com>
> Sent: Friday, October 31, 2014 2:40:45 PM
> Subject: Re: [midPoint] Email Notification

> Thanks for the information,

> The one he had given me does not work, it errors out

> So this does NOT work

> "Your Student ID is " + requestee?.getEmployeeNumber() + " \n\n" +
> "Your Username is " + requestee?.getName()?.getOrig() + " \n\n" +
> "Your Password is " + midpoint.getPlaintextUserPassword(requestee); + " \n\n"
> +

> But if I remove the password like in the below, it works, so it is the
> password code,

> "Your Student ID is " + requestee?.getEmployeeNumber() + " \n\n" +
> "Your Username is " + requestee?.getName()?.getOrig() + " \n\n" +

> Is there anything else in the password string that is incorrect?

> JASON

> On Fri, Oct 31, 2014 at 6:01 AM, Ivan Noris < Ivan.Noris at evolveum.com >
> wrote:

> > Hi Jason,
> 

> > 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.
> 

> > Back to notifications. I've just hacked my notifications like this to show
> > you how to access user's properties:
> 

> > <handler>
> 
> > <simpleUserNotifier>
> 
> > <recipientExpression>
> 
> > <value>vix at localhost</value>
> 
> > </recipientExpression>
> 
> > <subjectExpression>
> 
> > <script>
> 
> > <code>
> 
> > if (event.isSuccess())
> 
> > tmpText = "[IDM] SUCCESS: User " + event.getChangeType() + " operation
> > succeeded for "
> 
> > else if (event.isFailure())
> 
> > tmpText = "[IDM] ERROR: User " + event.getChangeType() + " operation failed
> > for "
> 
> > else tmpText = "[IDM] IN PROGRESS: User " + event.getChangeType() + "
> > operation in progress for "
> 

> > tmpText + requestee?.getName()?.getOrig() + ', family= ' +
> > requestee?.getFamilyName()?.getOrig() + ', employee number= ' +
> > requestee?.getEmployeeNumber() + ', property employeeNumber= ' +
> > basic.getPropertyValue(requestee, 'employeeNumber')
> 
> > </code>
> 
> > </script>
> 
> > </subjectExpression>
> 
> > <transport>mail</transport>
> 
> > </simpleUserNotifier>
> 
> > </handler>
> 

> > Subject in e-mail became:
> 

> > Subject: [IDM] SUCCESS: User ADD operation succeeded for bbbbb,
> 
> > family= Rimmer, employee number= 12123434,
> 
> > property employeeNumber= 12123434
> 

> > For standard polystring attributes, you may use simple
> > requestee?.getFamilyName()?.getOrig()
> 
> > For standard string attributes, you may use simple
> > requestee?.getEmployeeNumber()
> 

> > Please see our Common Schema to see which attribute is Polystring.
> 

> > Or you can use Basic library's basic.getPropertyValue(requestee,
> > 'employeeNumber').
> 

> > To access the extended attributes, you need to use Basic library
> > (basic.getExtensionPropertyValue(...))
> 

> > I have already added such examples to our
> > https://wiki.evolveum.com/display/midPoint/Notifications page earlier.
> 

> > Regards,
> 
> > Ivan
> 

> > > From: "Jason Everling" < jeverling at bshp.edu >
> > 
> 
> > > To: "midPoint General Discussion" < midpoint at lists.evolveum.com >
> > 
> 
> > > Sent: Thursday, October 30, 2014 7:39:01 PM
> > 
> 
> > > Subject: Re: [midPoint] Email Notification
> > 
> 

> > > 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.
> > 
> 

> > > I need to add in the password and Employee Number which is actually the
> > > student ID,
> > 
> 

> > > Is this correct, I couldn't find much on the subject,
> > 
> 

> > > Your Password is " + requestee?.getPassword()?.getOrig()
> > 
> 
> > > Your Student ID is " + requestee?.getEmployeeNumber()?.getOrig()
> > 
> 

> > > Thanks for all your help!
> > 
> 

> > > On Wed, Oct 29, 2014 at 3:07 PM, Jason Everling < jeverling at bshp.edu >
> > > wrote:
> > 
> 

> > > > Ohh I see, Thanks!
> > > 
> > 
> 

> > > > JASON
> > > 
> > 
> 

> > > > On Wed, Oct 29, 2014 at 3:01 PM, Ivan Noris < ivan.noris at evolveum.com >
> > > > wrote:
> > > 
> > 
> 

> > > > > Hi Jason,
> > > > 
> > > 
> > 
> 

> > > > > On 10/29/2014 07:26 PM, Jason Everling wrote:
> > > > 
> > > 
> > 
> 

> > > > > > Not that one, that one works just fine but if I try to add to it is
> > > > > > when
> > > > > > it
> > > > > > fails, like
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > <bodyExpression>
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > <script>
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > <code>
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > Welome to blah blah, the following below are links to the various
> > > > > > resources
> > > > > > you will use here
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > Your Username is + requestee?.getName()?.getOrig()
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > You should login and should your password at http://www.example/com
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > Link 1
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > Link 2
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > Link 3
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > </code>
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > </script>
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > </bodyExpression>
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > 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).
> > > > 
> > > 
> > 
> 

> > > > > For example in my previous sample, the Groovy expression "[IDM] Your
> > > > > username
> > > > > is: " + requestee?.getName()?.getOrig() is actually the same as:
> > > > 
> > > 
> > 
> 

> > > > > return " [IDM] Your username is: " + requestee?.getName()?.getOrig()
> > > > 
> > > 
> > 
> 

> > > > > In your case, you are missing:
> > > > 
> > > 
> > 
> 
> > > > > 1) quotes for strings
> > > > 
> > > 
> > 
> 
> > > > > 2) + operator for concatenating strings
> > > > 
> > > 
> > 
> 

> > > > > So your example needs to be rewritten to maintain your required
> > > > > formatting,
> > > > > as:
> > > > 
> > > 
> > 
> 

> > > > > <bodyExpression>
> > > > 
> > > 
> > 
> 
> > > > > <script>
> > > > 
> > > 
> > 
> 
> > > > > <code>
> > > > 
> > > 
> > 
> 
> > > > > "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 http://www.example/com "
> > > > 
> > > 
> > 
> 
> > > > > </code>
> > > > 
> > > 
> > 
> 
> > > > > </script>
> > > > 
> > > 
> > 
> 
> > > > > </bodyExpression>
> > > > 
> > > 
> > 
> 

> > > > > (this is a copy/paste from actual System Configuration)
> > > > 
> > > 
> > 
> 

> > > > > Which will produce notification for example:
> > > > 
> > > 
> > 
> 

> > > > > Welome to blah blah, the following below are links to the various
> > > > > resources
> > > > 
> > > 
> > 
> 
> > > > > you will use here.
> > > > 
> > > 
> > 
> 
> > > > > Your Username is hulahop
> > > > 
> > > 
> > 
> 
> > > > > You should login and should your password at http://www.example/com
> > > > 
> > > 
> > 
> 

> > > > > (this is copy/paste from actual e-mail that was sent).
> > > > 
> > > 
> > 
> 

> > > > > So now you should be able to do anything (except the HTML discussed
> > > > > earlier).
> > > > 
> > > 
> > 
> 

> > > > > Regards,
> > > > 
> > > 
> > 
> 
> > > > > Ivan
> > > > 
> > > 
> > 
> 

> > > > > > On Wed, Oct 29, 2014 at 1:18 PM, Ivan Noris <
> > > > > > ivan.noris at evolveum.com
> > > > > > >
> > > > > > wrote:
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > Hi Jason,
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > so the following didn't work for you? It looks ok at the first
> > > > > > > look.
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > 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.
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > > <bodyExpression>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > <script>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > <code>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > "[IDM] Your username is: " + requestee?.getName()?.getOrig()
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > </code>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > </script>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > > </bodyExpression>
> > > > > > > 
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > Regards,
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > Ivan
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > --
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > Ing. Ivan Noris
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > Senior Identity Management Engineer evolveum.com
> > > > > > > ___________________________________________
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > "Idem per idem - semper idem Vix."
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > > _______________________________________________
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > midPoint mailing list
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > midPoint at lists.evolveum.com
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > > http://lists.evolveum.com/mailman/listinfo/midpoint
> > > > > > 
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > CONFIDENTIALITY NOTICE:
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > 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.
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > > _______________________________________________
> > > > > 
> > > > 
> > > 
> > 
> 
> > > > > > midPoint mailing list midPoint at lists.evolveum.com
> > > > > > http://lists.evolveum.com/mailman/listinfo/midpoint
> > > > > 
> > > > 
> > > 
> > 
> 

> > > > > --
> > > > 
> > > 
> > 
> 
> > > > > Ing. Ivan Noris
> > > > 
> > > 
> > 
> 
> > > > > Senior Identity Management Engineer evolveum.com
> > > > > ___________________________________________
> > > > 
> > > 
> > 
> 
> > > > > "Idem per idem - semper idem Vix."
> > > > 
> > > 
> > 
> 

> > > > > _______________________________________________
> > > > 
> > > 
> > 
> 
> > > > > midPoint mailing list
> > > > 
> > > 
> > 
> 
> > > > > midPoint at lists.evolveum.com
> > > > 
> > > 
> > 
> 
> > > > > http://lists.evolveum.com/mailman/listinfo/midpoint
> > > > 
> > > 
> > 
> 

> > > CONFIDENTIALITY NOTICE:
> > 
> 
> > > 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.
> > 
> 

> > > _______________________________________________
> > 
> 
> > > midPoint mailing list
> > 
> 
> > > midPoint at lists.evolveum.com
> > 
> 
> > > http://lists.evolveum.com/mailman/listinfo/midpoint
> > 
> 

> > --
> 
> > Ing. Ivan Noris
> 
> > Senior Identity Management Engineer
> 
> > evolveum.com
> 
> > ___________________________________________
> 
> > "Idem per idem - semper idem Vix."
> 

> > _______________________________________________
> 
> > midPoint mailing list
> 
> > midPoint at lists.evolveum.com
> 
> > http://lists.evolveum.com/mailman/listinfo/midpoint
> 

> CONFIDENTIALITY NOTICE:
> 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.

> _______________________________________________
> midPoint mailing list
> midPoint at lists.evolveum.com
> http://lists.evolveum.com/mailman/listinfo/midpoint

-- 
Ing. Ivan Noris 
Senior Identity Management Engineer 
evolveum.com 
___________________________________________ 
"Idem per idem - semper idem Vix." 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.evolveum.com/pipermail/midpoint/attachments/20141031/38cd54d5/attachment.htm>


More information about the midPoint mailing list