The concept was as follows - allow a process or a user to send in multiple LDAP filter criteria and send emails to all those users returned from the service. For example, a process may want to send an email to not only one user (cn='userID'), but also that user and a everyone with the title supervisor (title='supervisor').
Email service explained.
Email service contract expects the following:
- A subject for the email
- A body for the email (can send in a nicely formatted HTML)
- The LDAP attribute(s) you want to filter and the value(s) - 1 to many
- cn, userID
- title, supervisor
The process then enters another sub-process (email sub-process). The first thing this process does is set the in process variable $countNodes to $countNodes +1. Remember $countNodes is set to 0 by default in the main sub-process because if we have multiple LDAP parameters being sent in, when the email sub-process is completed we may have to start all over again so we have to reset $countNodes. This email sub-process will only exit when $countNodes equals count(result) - the xpath function count() of the result nodes returned from the LDAP Rest service. Next a gateway evaluates the $ldap variable and since we set it to yes, we call LDAP REST service. We pass in the first filter by using the Intalio data editor and then in process variable $mainLoop to select the node position. So, params/attribute[$mainLoop] and params/filter[$mainLoop]. LDAP returns 1 or more user information and then we start sending emails. We use the $countNodes variable to iterate through all the potential results. So to get the first email, we say results/result[$countNodes]/attribute[name='mail']/value. This gives us the first person's email. After the email is sent, we set the $ldap variable to no, because we do not need to call ldap again at this point. If more emails are to be sent, we loop back in the email sub-process, do not go LDAP REST service because we set $ldap to no and $countNodes is now set to 2. The next email will be sent. If there are no emails, then $countNodes = count(result) and we exit the email sub-process. But, if we sent in more then one LDAP filter, we loop back to the very beginning of the main sub-process because $countParams does not equal count(params). We also set $mainLoop to 2 and $ldap variable to yes because we need to call the LDAP REST service again to get new user(s) information. So, we take the next LDAP filters based on node position the user sent in and start the entire email sub-process over. When email sub-process completes again, if $mainLoop = count(params), then we exit the main sub-process and the email service ends.
You can call this email service from within an existing business process designed in Intalio or an external system since the email service generated in Intalio provides you with a WSDL. So for example, you could call this email service from within Orbeon.
If you would like to implement something similiar in your organization, contact BTM Software Solutions for more information.