[midPoint] General Notifier Script Conditions

Sylvaire kevin TIPA sylvaire-kevin.tipa at mythalesgroup.io
Fri Jul 27 00:48:54 CEST 2018


Hey, you have two type of event, One for the guy which will approve / refuse the approbation. And one for the requester.

This code permit to find if new approbation workflow is started and send some notification to the Admin user which will be approve / refuse.
isWorkItemAllocationEventAdd = (event.getClass() == WorkItemAllocationEvent.class && event.isAdd() ? true : false)

Note the event.isAdd() that maybe is what you want (event.isAdd() selected only when approbation request has started.).

Cordialement,




Sylvaire-Kevin TIPA
Thales Services / OIC / DevOps Automatisation Infrastructures
…………………………………………………………………………………………
THALES SERVICES SAS
44 Quai Charles de Gaulle
CS 20100
69463 Lyon Cedex 06
…………………………………………………………………………………………
www.thalesgroup.com



-----Message d'origine-----
De : midPoint [mailto:midpoint-bounces at lists.evolveum.com] De la part de Brad Firestone
Envoyé : vendredi 27 juillet 2018 00:36
À : midPoint General Discussion <midpoint at lists.evolveum.com>
Objet : [midPoint] General Notifier Script Conditions

Hi All,

I am using a Approval Workflow when a midPoint User is deleted.  I want to use a general notifier to send an email into our ticket system.  I've got it somewhat working, but trying to customize the messages based on the possible events/status that might occur.  I'm NOT a programmer, so just trying to get the working by trial and error.  There will be more changes to my subject and body text once I can figure out the correct conditional syntax.

Here is my subjectExpression section:
<subjectExpression>
<script>
<code>
                     tmpObject = 'midPoint Approval '
                     if (event.isSuccess())
                         tmpText =  tmpObject + event?.getChangeType() + " pending"
                     else if (event.isFailure())
                         tmpText = tmpObject + "Rejected "
                     else  tmpText = "[IDM] Operation Cancelled: " + tmpObject + event?.getChangeType() + " Cancelled"
                     return tmpText
</code>
</script>
</subjectExpression>

I receive the following subject text based on where in the process we are:
Request to Delete a User:  midPoint Approval ADD pending Reject the Request:  midPoint Approval Rejected Approve the Request:  midPoint Approval DELETE pending Cancel the Request:  [IDM] Operation Cancelled: midPoint Approval DELETE Cancelled

So it appears that both the Request to Delete, and an Approval to Delete are (event.isSuccess) but of a different event?.getChangeType.

I am trying to figure more out using the bodyExperssion section.  I would like to have something like the following:

<bodyExpression>
<script>
<code>
                 if ((event.isSuccess()) &&
(event?.getChangeType() == 'ADD'))
                   tmpBody =  "An approval process has started.  Please login to midPoint and look for available Work Items."
                else if ((event.isSuccess()) &&
(event?.getChangeType() == 'DELETE'))
                   tmpBody =  "An approval process was completed: APPROVED"
                else if (event.isFailure())
                   tmpBody =  "The approval was rejected."
                else  tmpBody = "The approval process was terminated."
                return tmpBody
</code>
</script>
</bodyExperssion>

My conditions apparently aren't correct, because I get the following body text when I request the deletion:  The approval process was terminated.
If anyone has ideas of how to change my conditions, that would be great!
Thank you!
Brad
_______________________________________________
midPoint mailing list
midPoint at lists.evolveum.com
http://lists.evolveum.com/mailman/listinfo/midpoint
This message contains confidential information and is intended only for the individual(s) addressed in the message. If you are not the named addressee, you should not disseminate, distribute, or copy this e-mail. If you are not the intended recipient, you are notified that disclosing, distributing, or copying this e-mail is strictly prohibited.


More information about the midPoint mailing list