[midPoint] General Notifier Script Conditions
Brad Firestone
bhotrock at gmail.com
Fri Jul 27 00:36:14 CEST 2018
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
More information about the midPoint
mailing list